[RFC][PATCH 10/11] drm: Fix debugfs edid_override locking

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

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

The edid is protected by mode_config.mutex. Grab the lock when frobbing
the debugfs edid_override thing.

Cc: Keith Packard <keithp@xxxxxxxxxx>
Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/drm_debugfs.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index b2482818fee8..caac17145629 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -275,11 +275,17 @@ static ssize_t connector_write(struct file *file, const char __user *ubuf,
 static int edid_show(struct seq_file *m, void *data)
 {
 	struct drm_connector *connector = m->private;
-	struct drm_property_blob *edid = connector->edid_blob_ptr;
+	struct drm_property_blob *edid;
+
+	mutex_lock(&connector->dev->mode_config.mutex);
+
+	edid = connector->edid_blob_ptr;
 
 	if (connector->override_edid && edid)
 		seq_write(m, edid->data, edid->length);
 
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
 	return 0;
 }
 
@@ -305,6 +311,8 @@ static ssize_t edid_write(struct file *file, const char __user *ubuf,
 
 	edid = (struct edid *) buf;
 
+	mutex_lock(&connector->dev->mode_config.mutex);
+
 	if (len == 5 && !strncmp(buf, "reset", 5)) {
 		connector->override_edid = false;
 		ret = drm_mode_connector_update_edid_property(connector, NULL);
@@ -318,6 +326,8 @@ static ssize_t edid_write(struct file *file, const char __user *ubuf,
 			connector->override_edid = true;
 	}
 
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
 	kfree(buf);
 
 	return (ret) ? ret : len;
-- 
2.13.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux