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

Jyri Sarha jsarha at ti.com
Thu Sep 1 13:39:22 UTC 2016


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 at 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 --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;
 	}
 
-- 
1.9.1



More information about the dri-devel mailing list