drm/atomic: Refuse to add invalid objects to requests
authorDaniel Stone <daniels@collabora.com>
Wed, 7 Mar 2018 12:41:12 +0000 (12:41 +0000)
committerDaniel Stone <daniels@collabora.com>
Wed, 7 Mar 2018 17:19:29 +0000 (17:19 +0000)
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@collabora.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
xf86drmMode.c

index 15957ff..bd59ef2 100644 (file)
@@ -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;