From: Ville Syrjälä Date: Fri, 7 Nov 2014 09:16:01 +0000 (+0200) Subject: drm/i915: Don't deref NULL crtc in intel_get_pipe_from_connector() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d3babd3fcd92f345ab3c627ad6bfa1463de52ba2;p=linux-beck.git drm/i915: Don't deref NULL crtc in intel_get_pipe_from_connector() 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ä Reviewed-by: Jani Nikula Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 1509ab494f27..7c2ecbe43ca5 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -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;