diff options
author | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2016-09-05 10:06:13 +0200 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2016-09-06 19:56:41 +0200 |
commit | 4e9951d960932d648197d691aa28a7bc0ced1b56 (patch) | |
tree | 07497d290dfdd2b63877c5b42349c039a2cde1c0 /drivers/gpu/drm/drm_atomic.c | |
parent | drm/doc: Add a few words on validation with IGT (diff) | |
download | linux-4e9951d960932d648197d691aa28a7bc0ced1b56.tar.xz linux-4e9951d960932d648197d691aa28a7bc0ced1b56.zip |
drm/atomic: Reject properties not part of the object.
The legacy setprop ioctl doesn't attempt to set properties
that are not enumerated on the object. The atomic ioctl does,
fix this by validating first.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1473062773-5045-1-git-send-email-maarten.lankhorst@linux.intel.com
Diffstat (limited to '')
-rw-r--r-- | drivers/gpu/drm/drm_atomic.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 5cb2e22d5d55..a5126e5c05ee 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1609,7 +1609,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, struct drm_crtc_state *crtc_state; unsigned plane_mask; int ret = 0; - unsigned int i, j; + unsigned int i, j, k; /* disallow for drivers not supporting atomic: */ if (!drm_core_check_feature(dev, DRIVER_ATOMIC)) @@ -1691,6 +1691,15 @@ retry: goto out; } + for (k = 0; k < obj->properties->count; k++) + if (obj->properties->properties[k]->base.id == prop_id) + break; + + if (k == obj->properties->count) { + ret = -EINVAL; + goto out; + } + prop = drm_property_find(dev, prop_id); if (!prop) { drm_mode_object_unreference(obj); |