drm/i915: Don't deref NULL crtc in intel_get_pipe_from_connector()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 7 Nov 2014 09:16:01 +0000 (11:16 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 14 Nov 2014 09:29:19 +0000 (10:29 +0100)
If the connector would have an encoder but the encoder didn't have a
crtc we might dereference a NULL crtc here. I suppose that should never
happen due to intel_sanitize_encoder(), but let's be a bit paranoid
print a warning if we ever hit this and return INVALID_PIPE to the
caller.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c

index 1509ab494f2754436f350a04c1c25d751ba12f7d..7c2ecbe43ca50585da8c0efb268fcdc0bd609183 100644 (file)
@@ -11999,7 +11999,7 @@ enum pipe intel_get_pipe_from_connector(struct intel_connector *connector)
 
        WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 
-       if (!encoder)
+       if (!encoder || WARN_ON(!encoder->crtc))
                return INVALID_PIPE;
 
        return to_intel_crtc(encoder->crtc)->pipe;