Re: [Intel-gfx] [PATCH 4/4] drm/i915: Check for NULL atomic state in intel_crtc_disable_noatomic()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 20, 2017 at 04:28:45PM +0200, Ander Conselvan de Oliveira wrote:
> In intel_crtc_disable_noatomic(), bail on a failure to allocate an
> atomic state to avoid a NULL pointer dereference.
> 
> Found by coverity.
> 
> Fixes: 4a80655827af ("drm/i915: Pass atomic state to crtc enable/disable functions")
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>
> Cc: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: <stable@xxxxxxxxxxxxxxx> # v4.9+
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@xxxxxxxxx>

Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0759e8b..38d5178 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6882,6 +6882,12 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
>  	}
>  
>  	state = drm_atomic_state_alloc(crtc->dev);
> +	if (!state) {
> +		DRM_DEBUG_KMS("failed to disable [CRTC:%d:%s], out of memory",
> +			      crtc->base.id, crtc->name);
> +		return;
> +	}
> +
>  	state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
>  
>  	/* Everything's already locked, -EDEADLK can't happen. */
> -- 
> 2.5.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]