drm: Check crtc x and y coordinates
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 13 Mar 2012 10:35:41 +0000 (12:35 +0200)
committerDave Airlie <airlied@redhat.com>
Thu, 15 Mar 2012 09:49:26 +0000 (09:49 +0000)
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>
drivers/gpu/drm/drm_crtc.c

index d11763f7211abe242386fb8208273d033d03586b..3a42c9cb0eb2e16517f8640d05558e0fe5ddf850 100644 (file)
@@ -1774,6 +1774,10 @@ 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)
+               return -ERANGE;
+
        mutex_lock(&dev->mode_config.mutex);
        obj = drm_mode_object_find(dev, crtc_req->crtc_id,
                                   DRM_MODE_OBJECT_CRTC);
This page took 0.045659 seconds and 5 git commands to generate.