[PATCH libdrm] drm/atomic: Refuse to add invalid objects to requests

Daniel Stone daniels at collabora.com
Wed Mar 7 12:42:15 UTC 2018


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

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 xf86drmMode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index 15957ffc..bd59ef25 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -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;
 
-- 
2.14.3



More information about the dri-devel mailing list