]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Update the restrict check to filter out wrong Ring ID passed by user-space
authorZhao Yakui <yakui.zhao@intel.com>
Thu, 17 Apr 2014 02:37:36 +0000 (10:37 +0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 5 May 2014 07:08:44 +0000 (09:08 +0200)
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h

index b9dcc2869edc89a512ee39fe8afe0977266e2001..0aa1b4cb1f6dbff4a67fe4b45d1e5b0597e8a6f3 100644 (file)
@@ -1037,7 +1037,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        if (args->flags & I915_EXEC_IS_PINNED)
                flags |= I915_DISPATCH_PINNED;
 
-       if ((args->flags & I915_EXEC_RING_MASK) > I915_NUM_RINGS) {
+       if ((args->flags & I915_EXEC_RING_MASK) > LAST_USER_RING) {
                DRM_DEBUG("execbuf with unknown ring: %d\n",
                          (int)(args->flags & I915_EXEC_RING_MASK));
                return -EINVAL;
index 54839165eb6d809cbe83413c9bfdcbd7de6a31e3..7c0eb33d5027a444a97562cd84cf25f9afeda234 100644 (file)
@@ -63,6 +63,7 @@ struct  intel_ring_buffer {
                VECS,
        } id;
 #define I915_NUM_RINGS 4
+#define LAST_USER_RING (VECS + 1)
        u32             mmio_base;
        void            __iomem *virtual_start;
        struct          drm_device *dev;