Skip to content

Commit 2e54154

Browse files
MiniMangosteenalexdeucher
authored andcommitted
drm/amdgpu: Fix potential fence use-after-free v2
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 <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent b75efe8 commit 2e54154

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,15 +1654,15 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
16541654
continue;
16551655

16561656
r = dma_fence_wait_timeout(fence, true, timeout);
1657+
if (r > 0 && fence->error)
1658+
r = fence->error;
1659+
16571660
dma_fence_put(fence);
16581661
if (r < 0)
16591662
return r;
16601663

16611664
if (r == 0)
16621665
break;
1663-
1664-
if (fence->error)
1665-
return fence->error;
16661666
}
16671667

16681668
memset(wait, 0, sizeof(*wait));

0 commit comments

Comments
 (0)