Re: [PATCHv2 3/4] drm: make drm_atomic_set_mode_prop_for_crtc() more reliable

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

 



On Tue, May 31, 2016 at 03:03:17PM +0300, Tomi Valkeinen wrote:
> drm_atomic_set_mode_prop_for_crtc() does not clear the state->mode, so
> old data may be left there when a new mode is set, possibly causing odd
> issues.
> 
> This patch improves the situation by always clearing the state->mode
> first.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/drm_atomic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 3ff1ed7b33db..c204ef32df16 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -351,6 +351,8 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
>  	drm_property_unreference_blob(state->mode_blob);
>  	state->mode_blob = NULL;
>  
> +	memset(&state->mode, 0, sizeof(state->mode));
> +
>  	if (blob) {
>  		if (blob->length != sizeof(struct drm_mode_modeinfo) ||
>  		    drm_mode_convert_umode(&state->mode,
> @@ -363,7 +365,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
>  		DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
>  				 state->mode.name, state);
>  	} else {
> -		memset(&state->mode, 0, sizeof(state->mode));
>  		state->enable = false;
>  		DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
>  				 state);
> -- 
> 2.5.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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]