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
[ Upstream commit 2e54154 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
MiniMangosteen authored and gregkh committed Aug 23, 2023
1 parent 3a89f3b commit dd0b3b3
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 @@ -1607,15 +1607,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 dd0b3b3

Please sign in to comment.