Skip to contentSkip to conversation

drm/atomic: Refuse to add invalid objects to requests

PATCH In review Daniel Stone 3 participants 3 messages Mar 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/atomic: Refuse to add invalid objects to requests

Object and property IDs cannot be zero. Prevent them from being added to the request stream at all, rather than breaking at commit time.

---
 xf86drmMode.c | 3 +++
 1 file changed, 3 insertions(+)
xf86drmMode.c +3 -0
index 15957ffc..bd59ef25 100644
@@ -1313,6 +1313,9 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
 	if (!req)
 		return -EINVAL;
 
+	if (object_id == 0 || property_id == 0)
+		return -EINVAL;
+
 	if (req->cursor >= req->size_items) {
 		drmModeAtomicReqItemPtr new;
 
Signature · 6 lines
2.14.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Daniel Stone

Object and property IDs cannot be zero. Prevent them from being added to the request stream at all, rather than breaking at commit time.

---
 xf86drmMode.c | 3 +++
 1 file changed, 3 insertions(+)
xf86drmMode.c +0 -0
index 15957ffc..bd59ef25 100644

xf86drmMode.c int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, · line 1317

Quoted 5 lines
xf86drmMode.c +2 -0
@@ -1313,6 +1313,9 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
 	if (!req)
 		return -EINVAL;
 
+	if (object_id == 0 || property_id == 0)
+		return -EINVAL;

... and gives us a perfect spot to gdb into a backtrace and figure out wtf is going on with drm_hwc :-)
-Daniel

Quoted 11 lines
xf86drmMode.c +1 -0
+
 	if (req->cursor >= req->size_items) {
 		drmModeAtomicReqItemPtr new;
 
Signature · 6 lines
2.14.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 8 lines · Daniel Vetter
Quoted 2 lines · Daniel Stone

Object and property IDs cannot be zero. Prevent them from being added to the request stream at all, rather than breaking at commit time.

... and gives us a perfect spot to gdb into a backtrace and figure out wtf is going on with drm_hwc :-)

Heh, and pushed now. Thanks Daniel!

Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel