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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Testcase: igt/gem_exec_params/rel-constants-*
Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux