]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
drm/i915/execbuffer: Correctly clear the current object list upon EFAULT
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 10 Jan 2011 12:09:12 +0000 (12:09 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 11 Jan 2011 22:55:29 +0000 (22:55 +0000)
Before releasing the lock in order to copy the relocation list from user
pages, we need to drop all the object references as another thread may
usurp and execute another batchbuffer before we reacquire the lock.
However, the code was buggy and failed to clear the list...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
drivers/gpu/drm/i915/i915_gem_execbuffer.c

index 97d5fbd8ea137735a0bf3f1b4387fd6e88f43c1b..0445770cc23c1cfedf5dfe8ceef0de36744d565e 100644 (file)
@@ -622,7 +622,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
        int i, total, ret;
 
        /* We may process another execbuffer during the unlock... */
-       while (list_empty(objects)) {
+       while (!list_empty(objects)) {
                obj = list_first_entry(objects,
                                       struct drm_i915_gem_object,
                                       exec_list);
@@ -665,7 +665,6 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
        }
 
        /* reacquire the objects */
-       INIT_LIST_HEAD(objects);
        eb_reset(eb);
        for (i = 0; i < count; i++) {
                struct drm_i915_gem_object *obj;
@@ -1353,4 +1352,3 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
        drm_free_large(exec2_list);
        return ret;
 }
-