[Intel-gfx] [PATCH] drm/i915: Do not dereference NULL crtc or fb until after checking

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 2 22:16:47 CEST 2013


On Fri, Aug 02, 2013 at 08:39:49PM +0100, Chris Wilson wrote:
> Fixes regression from
> commit 4906557eb37b7fef84fad4304acef6dedf919880
> Author: Rodrigo Vivi <rodrigo.vivi at gmail.com>
> Date:   Thu Jul 11 18:45:05 2013 -0300
> 
>     drm/i915: Hook PSR functionality
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67526
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Rodrigo Vivi <rodrigo.vivi at gmail.com>
> Cc: Ben Widawsky <ben at bwidawsk.net>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 928b42f..7e16c6e 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1514,10 +1514,10 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_device *dev = dig_port->base.base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct drm_crtc *crtc = dig_port->base.base.crtc;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> -	struct drm_i915_gem_object *obj = to_intel_framebuffer(crtc->fb)->obj;
> -	struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
> +	struct drm_crtc *crtc;
> +	struct intel_crtc *intel_crtc;
> +	struct drm_i915_gem_object *obj;
> +	struct intel_encoder *intel_encoder;

Sigh. I didn't mean to move the intel_encoder in the end. That can be
still be set up during the init as it not part of the bug fix.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list