]> git.karo-electronics.de Git - karo-tx-linux.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>
Thu, 24 Apr 2014 15:19:40 +0000 (17:19 +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 96d0aae6f975aec234493869ee4f1f637c9a3e8c..19ea4ddf9c761f95bc1e3338178e8b160d2bed78 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;