[Intel-gfx] [PATCH 2/3] drm/i915: Catch abuse of I915_EXEC_CONSTANTS_*

Daniel Vetter daniel.vetter at ffwll.ch
Wed Apr 23 20:32:19 CEST 2014


A bit tricky since 0 is also a valid constant ...

Testcase: igt/gem_exec_params/rel-constants-*
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 40ae5ff0a031..c2e5d39a1df8 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1058,8 +1058,10 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	case I915_EXEC_CONSTANTS_REL_GENERAL:
 	case I915_EXEC_CONSTANTS_ABSOLUTE:
 	case I915_EXEC_CONSTANTS_REL_SURFACE:
-		if (ring == &dev_priv->ring[RCS] &&
-		    mode != dev_priv->relative_constants_mode) {
+		if (mode != 0 && ring != &dev_priv->ring[RCS])
+			return -EINVAL;
+
+		if (mode != dev_priv->relative_constants_mode) {
 			if (INTEL_INFO(dev)->gen < 4)
 				return -EINVAL;
 
-- 
1.8.1.4




More information about the Intel-gfx mailing list