[Intel-gfx] [PATCH] drm: check user mode flags for validity
Jesse Barnes
jbarnes at virtuousgeek.org
Wed May 8 23:01:25 CEST 2013
Requested-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
drivers/gpu/drm/drm_crtc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 792c3e3..72ae33a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1318,6 +1318,18 @@ static int drm_crtc_convert_umode(struct drm_display_mode *out,
if (in->clock > INT_MAX || in->vrefresh > INT_MAX)
return -ERANGE;
+ /* Reject modes with invalid h/vsync */
+ if (!(in->flags & (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC)))
+ return -EINVAL;
+ if ((in->flags & DRM_MODE_FLAG_PHSYNC) &&
+ (in->flags & DRM_MODE_FLAG_NHSYNC))
+ return -EINVAL;
+ if (!(in->flags & (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC)))
+ return -EINVAL;
+ if ((in->flags & DRM_MODE_FLAG_PVSYNC) &&
+ (in->flags & DRM_MODE_FLAG_NVSYNC))
+ return -EINVAL;
+
out->clock = in->clock;
out->hdisplay = in->hdisplay;
out->hsync_start = in->hsync_start;
--
1.7.9.5
More information about the Intel-gfx
mailing list