From: Damien Lespiau Date: Wed, 25 Sep 2013 15:45:25 +0000 (+0100) Subject: drm: Reject modes with more than 1 stereo flags set X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a3ff6d5609145b06f602a5bc8e8bdbf66b96370b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git drm: Reject modes with more than 1 stereo flags set When setting a stereo 3D mode, there can be only one bit set describing the layout of the frambuffer(s). So reject invalid modes early. Reviewed-by: Ville Syrjälä Signed-off-by: Damien Lespiau Acked-by: Dave Airlie Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 454ac8a6381c..090415f418b8 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1319,6 +1319,10 @@ static int drm_crtc_convert_umode(struct drm_display_mode *out, if (in->clock > INT_MAX || in->vrefresh > INT_MAX) return -ERANGE; + /* At most, 1 set bit describing the 3D layout of the mode */ + if (hweight32(in->flags & DRM_MODE_FLAG_3D_MASK) > 1) + return -EINVAL; + out->clock = in->clock; out->hdisplay = in->hdisplay; out->hsync_start = in->hsync_start;