diff mbox

[RFC] drm: Fix property handling for mode object without object type

Message ID 1472737162-3507-1-git-send-email-jsarha@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jyri Sarha Sept. 1, 2016, 1:39 p.m. UTC
Fix property handling for mode object without mode object type.
drm_property_change_valid_get() crashes if atomic ioctl for mode
object does not specify the mode object type. This patch makes
drm_property_change_valid_get() to tolerate such requests.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---

This used to work in v4.8, but I have no idea if this is a right fix
or should we just gracefully reject ioctls to mode object properties
without mode object type. In such a case we need to fix our test tool [1].

[1] https://github.com/tomba/kmsxx

 drivers/gpu/drm/drm_property.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 4139afb..67261a2 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -877,7 +877,9 @@  bool drm_property_change_valid_get(struct drm_property *property,
 			return true;
 
 		*ref = __drm_mode_object_find(property->dev, value,
-					      property->values[0]);
+					      property->num_values ?
+					      property->values[0] :
+					      DRM_MODE_OBJECT_ANY);
 		return *ref != NULL;
 	}