Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Maarten Lankhorst and committed by
Sean Paul
4e9951d9 75ac4953

+10 -1
+10 -1
drivers/gpu/drm/drm_atomic.c
··· 1609 1609 struct drm_crtc_state *crtc_state; 1610 1610 unsigned plane_mask; 1611 1611 int ret = 0; 1612 - unsigned int i, j; 1612 + unsigned int i, j, k; 1613 1613 1614 1614 /* disallow for drivers not supporting atomic: */ 1615 1615 if (!drm_core_check_feature(dev, DRIVER_ATOMIC)) ··· 1688 1688 if (get_user(prop_id, props_ptr + copied_props)) { 1689 1689 drm_mode_object_unreference(obj); 1690 1690 ret = -EFAULT; 1691 + goto out; 1692 + } 1693 + 1694 + for (k = 0; k < obj->properties->count; k++) 1695 + if (obj->properties->properties[k]->base.id == prop_id) 1696 + break; 1697 + 1698 + if (k == obj->properties->count) { 1699 + ret = -EINVAL; 1691 1700 goto out; 1692 1701 } 1693 1702