summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhao Junwang <zhjwpku@gmail.com>2015-07-07 17:08:35 +0800
committerSasha Levin <sasha.levin@oracle.com>2015-08-04 14:27:42 -0400
commit6a85c7b5fdf5a300a25a5f804f24b8fb09e472f9 (patch)
tree730fc5d97cab646aec745b8af31b50a32ff8568f /drivers
parent04e685d86e0c3fd7b47bebb6efdd488222b500e1 (diff)
downloadlinux-stable-6a85c7b5fdf5a300a25a5f804f24b8fb09e472f9.tar.gz
linux-stable-6a85c7b5fdf5a300a25a5f804f24b8fb09e472f9.tar.bz2
linux-stable-6a85c7b5fdf5a300a25a5f804f24b8fb09e472f9.zip
drm: add a check for x/y in drm_mode_setcrtc
[ Upstream commit 01447e9f04ba1c49a9534ae6a5a6f26c2bb05226 ] legacy setcrtc ioctl does take a 32 bit value which might indeed overflow the checks of crtc_req->x > INT_MAX and crtc_req->y > INT_MAX aren't needed any more with this v2: -polish the annotation according to Daniel's comment Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Zhao Junwang <zhjwpku@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_crtc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b7f101b52d81..0cd6e0d7dd1a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2555,8 +2555,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
- /* For some reason crtc x/y offsets are signed internally. */
- if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX)
+ /*
+ * Universal plane src offsets are only 16.16, prevent havoc for
+ * drivers using universal plane code internally.
+ */
+ if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000)
return -ERANGE;
drm_modeset_lock_all(dev);