Quoting Ville Syrjala (2017-11-14 18:32:50) > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Currently userspace is allowed to feed in any king of garbage in the > high bits of the mode flags/type, as are drivers when probing modes. > Reject any mode with bogus flags/type. > > Hopefully this won't break any current userspace... > > Cc: Jose Abreu <Jose.Abreu@xxxxxxxxxxxx> > Cc: Adam Jackson <ajax@xxxxxxxxxx> > Cc: Keith Packard <keithp@xxxxxxxxxx> > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/drm_modes.c | 4 ++++ > include/uapi/drm/drm_mode.h | 24 ++++++++++++++++++++++++ > 2 files changed, 28 insertions(+) > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > index 1a72883b836e..f99ba963fb3e 100644 > --- a/drivers/gpu/drm/drm_modes.c > +++ b/drivers/gpu/drm/drm_modes.c > @@ -1036,6 +1036,10 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo); > enum drm_mode_status > drm_mode_validate_basic(const struct drm_display_mode *mode) > { > + if (mode->type & ~DRM_MODE_TYPE_ALL || > + mode->flags & ~DRM_MODE_FLAG_ALL) > + return MODE_BAD; I had to read this twice to realise they were different masks. (If the start and end of a word match expectations, the eye skips the middle.) Can we split this up into two separate ifs, so the reader doesn't fall into this trap :) -Chris _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel