Skip to content

Commit 13d0724

Browse files
ArvindYadavAMDalexdeucher
authored andcommitted
drm/amdgpu: fix use-after-unlock in eviction fence destroy
The eviction fence destroy path incorrectly calls dma_fence_put() on evf_mgr->ev_fence after releasing the ev_fence_lock. This introduces a potential use-after-unlock or race because another thread concurrently modifies evf_mgr->ev_fence. Fix this by grabbing a local reference to evf_mgr->ev_fence under the lock and using that for dma_fence_put() after waiting. Cc: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]> Reviewed-by: Sunil Khatri <[email protected]> Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent cc47305 commit 13d0724

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void amdgpu_eviction_fence_destroy(struct amdgpu_eviction_fence_mgr *evf_mgr)
183183
dma_fence_wait(&ev_fence->base, false);
184184

185185
/* Last unref of ev_fence */
186-
dma_fence_put(&evf_mgr->ev_fence->base);
186+
dma_fence_put(&ev_fence->base);
187187
}
188188

189189
int amdgpu_eviction_fence_attach(struct amdgpu_eviction_fence_mgr *evf_mgr,

0 commit comments

Comments
 (0)