drm: Do not accept garbage mode aspect ratio flags
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 20 Jun 2019 14:26:36 +0000 (17:26 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 24 Jun 2019 15:08:55 +0000 (18:08 +0300)
Don't let userspace feed us any old garbage in the mode aspect ratio
flags.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190620142639.17518-3-ville.syrjala@linux.intel.com
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/drm_modes.c

index 53acc6756ee0310017ccc6ef2255c7ef55c2e63e..847048dee048e89a565e2dfaaf31801d69284ac3 100644 (file)
@@ -1977,9 +1977,11 @@ int drm_mode_convert_umode(struct drm_device *dev,
        case DRM_MODE_FLAG_PIC_AR_256_135:
                out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135;
                break;
-       default:
+       case DRM_MODE_FLAG_PIC_AR_NONE:
                out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
                break;
+       default:
+               return -EINVAL;
        }
 
        out->status = drm_mode_validate_driver(dev, out);