drm/i915: use _safe version of list_for_each
Subsystems (3)
PATCH 1/1 drm/i915: use _safe version of list_for_each
We sometimes call i915_vma_unbind() inside the loop and that can free the vma.
Signed-off-by Dan Carpenter <[email protected]>
---
Static checker stuff. Untested.
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -2
@@ -524,7 +524,7 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, bool *need_relocs) {struct drm_i915_gem_object *obj; -struct i915_vma *vma; +struct i915_vma *vma, *n;struct list_head ordered_vmas;bool has_fenced_gpu_access =INTEL_INFO (ring->dev)->gen <4 ;int retry;
@@ -572,7 +572,7 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring,int ret =0 ;/* Unbind any ill-fitting objects or pin. */ -list_for_each_entry (vma, vmas, exec_list) { +list_for_each_entry_safe (vma, n, vmas, exec_list) {struct drm_i915_gem_exec_object2 *entry = vma->exec_entry;bool need_fence, need_mappable;
Quoted 2 lines · Dan Carpenter
We sometimes call
i915_vma_unbind()inside the loop and that can free the vma.
Oh. That is bad. The vma needs to be pinned here to prevent it being freed as otherwise we lose track of it during the execbuffer.
Ben?
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre