aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2012-03-13 06:35:41 -0400
committerDave Airlie <airlied@redhat.com>2012-03-15 05:49:26 -0400
commit1d97e9154821d52a5ebc226176d4839c7b86b116 (patch)
treef2ca2239eb3b5b2e8d99bd0f8b656fb8dd6a7eac /drivers/gpu/drm
parente36fae3889db38f6cacabea3998b9a09320f2ad2 (diff)
drm: Check crtc x and y coordinates
The crtc x/y panning coordinates are stored as signed integers internally. The user provides them as unsigned, so we should check that the user provided values actually fit in the internal datatypes. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_crtc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d11763f7211a..3a42c9cb0eb2 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1774,6 +1774,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1774 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 1774 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1775 return -EINVAL; 1775 return -EINVAL;
1776 1776
1777 /* For some reason crtc x/y offsets are signed internally. */
1778 if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX)
1779 return -ERANGE;
1780
1777 mutex_lock(&dev->mode_config.mutex); 1781 mutex_lock(&dev->mode_config.mutex);
1778 obj = drm_mode_object_find(dev, crtc_req->crtc_id, 1782 obj = drm_mode_object_find(dev, crtc_req->crtc_id,
1779 DRM_MODE_OBJECT_CRTC); 1783 DRM_MODE_OBJECT_CRTC);