Re: [RFC][PATCH 09/11] drm: Fix getconnector locking

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

 



On Tue, Feb 27, 2018 at 02:56:58PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> The edid is protected by mode_config.mutex so extend the locking to
> protect the property readout part as well.
> 
> Cc: Keith Packard <keithp@xxxxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Ehrm no, properties have their own locking and are safe.
drm_connector->edid is indeed protected by the mode_config.mutex, but
that's not the thing we're looking at here. Maybe we need to patch up the
struct drm_connector locking comments a bit to clarify this more?
-Daniel

> ---
>  drivers/gpu/drm/drm_connector.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 2bf19a37dbac..122060792b6f 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1624,15 +1624,12 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
>  			if (copy_to_user(mode_ptr + copied,
>  					 &u_mode, sizeof(u_mode))) {
>  				ret = -EFAULT;
> -				mutex_unlock(&dev->mode_config.mutex);
> -
>  				goto out;
>  			}
>  			copied++;
>  		}
>  	}
>  	out_resp->count_modes = mode_count;
> -	mutex_unlock(&dev->mode_config.mutex);
>  
>  	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
>  	encoder = drm_connector_get_encoder(connector);
> @@ -1650,6 +1647,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
>  	drm_modeset_unlock(&dev->mode_config.connection_mutex);
>  
>  out:
> +	mutex_unlock(&dev->mode_config.mutex);
> +
>  	drm_connector_put(connector);
>  
>  	return ret;
> -- 
> 2.13.6
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux