[Intel-gfx] [PATCH 3/3] drm/i915: Catch dirt in unused execbuffer fields

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


We need to make sure that userspace keeps on following the contract,
otherwise we won't be able to use the reserved fields at all.

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

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index c2e5d39a1df8..0f0aebdd8dbd 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1115,6 +1115,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			ret = -EFAULT;
 			goto pre_mutex_err;
 		}
+	} else {
+		if (args->DR1 || args->DR4 || args->cliprects_ptr)
+			return -EINVAL;
 	}
 
 	intel_runtime_pm_get(dev_priv);
@@ -1392,6 +1395,9 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 
+	if (args->rsvd2 != 0)
+		return -EINVAL;
+
 	exec2_list = kmalloc(sizeof(*exec2_list)*args->buffer_count,
 			     GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY);
 	if (exec2_list == NULL)
-- 
1.8.1.4




More information about the Intel-gfx mailing list