diff mbox

drm/i915: Reject undefined colorkey flags

Message ID 20180206204333.4399-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjala Feb. 6, 2018, 8:43 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Check that userspace isn't passing in garbage in the colorkey
ioctl flags.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Chris Wilson Feb. 6, 2018, 9:14 p.m. UTC | #1
Quoting Ville Syrjala (2018-02-06 20:43:33)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Check that userspace isn't passing in garbage in the colorkey
> ioctl flags.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I think we can retrospectively apply this filter. Afaict, only the ddx
ever hooked up this interface.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 3be22c0fcfb5..12a9536d7b7a 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1077,6 +1077,9 @@  int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
 	/* ignore the pointless "none" flag */
 	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 */
 	if ((set->flags & (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) == (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE))
 		return -EINVAL;