aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-12-17 06:56:24 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-12-17 12:29:43 -0500
commit23e1ce89af5404c7a35dbd008ca85fb6adb16aad (patch)
tree7ba1103ecafb72b057ae944d9927ffa42d236869 /drivers/gpu/drm/drm_crtc.c
parentabc0b1447d4974963548777a5ba4a4457c82c426 (diff)
drm: Do basic sanity checks for user modes
Currently userspace is allowed to pass in basiclly any kind of garbage to setcrtc. Try to catch the cases where the timings make no sense by passing the mode through drm_mode_validate_basic(). One concern here is that we now start to block some modes that have worked in the past. It's at least possible with when using i915 with LVDS/eDP. Previously we've just ignored everything but hdisplay/vdisplay from the user mode and just overwritten the rest with the panel fixed mode. So if someone has been passing a mode with just those populated that would now stop working. If that is a real problem, we can't add these checks to the core code and each driver would have to have its own sanity checks. So fingers crossed... Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 6700ebafef16..e3140c190556 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2673,6 +2673,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
2673 goto out; 2673 goto out;
2674 } 2674 }
2675 2675
2676 mode->status = drm_mode_validate_basic(mode);
2677 if (mode->status != MODE_OK) {
2678 ret = -EINVAL;
2679 goto out;
2680 }
2681
2676 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); 2682 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
2677 2683
2678 ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y, 2684 ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y,