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

Ville Syrjala ville.syrjala at linux.intel.com
Tue Feb 27 12:56:58 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

The edid is protected by mode_config.mutex so extend the locking to
protect the property readout part as well.

Cc: Keith Packard <keithp at keithp.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 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



More information about the dri-devel mailing list