@@ -139,6 +139,7 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
try_again:
ret = 0;
+ i915_gem_object_lock(obj); /* prevent i915_gem_close_object() */
spin_lock(&obj->vma.lock);
while (!ret && (vma = list_first_entry_or_null(&obj->vma.list,
struct i915_vma,
@@ -177,6 +178,7 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
}
list_splice_init(&still_in_list, &obj->vma.list);
spin_unlock(&obj->vma.lock);
+ i915_gem_object_unlock(obj);
if (ret == -EAGAIN && flags & I915_GEM_OBJECT_UNBIND_BARRIER) {
rcu_barrier(); /* flush the i915_vm_release() */
If the object is closed while we wait, that may move the vma we are waiting on to the parked list allowing it to be destroyed underneath the waiter. (i915_vma.kref! When do we want it? Yesterday!) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/i915_gem.c | 2 ++ 1 file changed, 2 insertions(+)