[Intel-gfx] [PATCH] drm/i915: Avoid NULL dereference with component_only tv_modes

Zhenyu Wang zhenyuw at linux.intel.com
Mon Nov 30 02:28:25 CET 2009


On 2009.11.27 22:22:04 +0800, Chris Wilson wrote:
> In commit d2d9f2324, the guard for a valid video mode was removed. This
> caused the regression:
> 
>   kernel crash during kms graphic boot on Intel GM4500 platform
>   https://bugzilla.redhat.com/show_bug.cgi?id=540218
> 
> This patches changes the logic slightly not to rely on a coupled
> variable, but to just check whether the video_modes is valid before
> dereferencing.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: David Woodhouse <dwmw2 at infradead.org>
> Cc: Zhenyu Wang <zhenyu.z.wang at intel.com>
> [ickle: Actually reference the correct bug report]
> ---
>  drivers/gpu/drm/i915/intel_tv.c |   11 ++++-------
>  1 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index a0e4bc4..d7465ca 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -1213,20 +1213,17 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
>  		tv_ctl |= TV_TRILEVEL_SYNC;
>  	if (tv_mode->pal_burst)
>  		tv_ctl |= TV_PAL_BURST;
> +
>  	scctl1 = 0;
> -	/* dda1 implies valid video levels */
> -	if (tv_mode->dda1_inc) {
> +	if (tv_mode->dda1_inc)
>  		scctl1 |= TV_SC_DDA1_EN;
> -	}
> -
>  	if (tv_mode->dda2_inc)
>  		scctl1 |= TV_SC_DDA2_EN;
> -
>  	if (tv_mode->dda3_inc)
>  		scctl1 |= TV_SC_DDA3_EN;
> -
>  	scctl1 |= tv_mode->sc_reset;
> -	scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
> +	if (video_levels)
> +		scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
>  	scctl1 |= tv_mode->dda1_inc << TV_SCDDA1_INC_SHIFT;
>  
>  	scctl2 = tv_mode->dda2_size << TV_SCDDA2_SIZE_SHIFT |
> -- 
> 1.6.5.3

Thanks Chris.

Acked-by: Zhenyu Wang <zhenyuw at linux.intel.com>

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20091130/4e4b6316/attachment.sig>


More information about the Intel-gfx mailing list