drm: Reject addfb2 with undefined flag bits set
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 8 Nov 2012 09:09:42 +0000 (09:09 +0000)
committerDave Airlie <airlied@redhat.com>
Tue, 20 Nov 2012 05:37:41 +0000 (15:37 +1000)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c

index 35336097fb47ca307fb9f9a78bd60d888333f68b..7ac3952f74fc5ed5f861885e0ef8f50ebed9e7c2 100644 (file)
@@ -2331,6 +2331,11 @@ int drm_mode_addfb2(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
+       if (r->flags & ~DRM_MODE_FB_INTERLACED) {
+               DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
+               return -EINVAL;
+       }
+
        if ((config->min_width > r->width) || (r->width > config->max_width)) {
                DRM_DEBUG_KMS("bad framebuffer width %d, should be >= %d && <= %d\n",
                          r->width, config->min_width, config->max_width);