Commit 89746e79 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Reject undefined colorkey flags

Check that userspace isn't passing in garbage in the colorkey
ioctl flags.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180206204333.4399-1-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 928f0cd0
...@@ -1073,6 +1073,9 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data, ...@@ -1073,6 +1073,9 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
/* ignore the pointless "none" flag */ /* ignore the pointless "none" flag */
set->flags &= ~I915_SET_COLORKEY_NONE; set->flags &= ~I915_SET_COLORKEY_NONE;
if (set->flags & ~(I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE))
return -EINVAL;
/* Make sure we don't try to enable both src & dest simultaneously */ /* Make sure we don't try to enable both src & dest simultaneously */
if ((set->flags & (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) == (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) if ((set->flags & (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) == (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment