Skip to content

Commit

Permalink
drm/amdgpu: Fix potential fence use-after-free v2
Browse files Browse the repository at this point in the history
fence Decrements the reference count before exiting.
Avoid Race Vulnerabilities for fence use-after-free.

v2 (chk): actually fix the use after free and not just move it.

Signed-off-by: shanzhulig <shanzhulig@gmail.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
MiniMangosteen authored and alexdeucher committed Jun 30, 2023
1 parent b75efe8 commit 2e54154
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
Expand Up @@ -1654,15 +1654,15 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
continue;

r = dma_fence_wait_timeout(fence, true, timeout);
if (r > 0 && fence->error)
r = fence->error;

dma_fence_put(fence);
if (r < 0)
return r;

if (r == 0)
break;

if (fence->error)
return fence->error;
}

memset(wait, 0, sizeof(*wait));
Expand Down

0 comments on commit 2e54154

Please sign in to comment.