Skip to content

Commit db9d992

Browse files
ciq-sahlbergPlaidCat
authored andcommitted
drm/amdgpu: Fix potential fence use-after-free v2
jira SECO-48 cve CVE-2023-51042 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 <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 2e54154) Signed-off-by: Ronnie Sahlberg <[email protected]>
1 parent 7c9dde4 commit db9d992

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
@@ -1522,15 +1522,15 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
15221522
continue;
15231523

15241524
r = dma_fence_wait_timeout(fence, true, timeout);
1525+
if (r > 0 && fence->error)
1526+
r = fence->error;
1527+
15251528
dma_fence_put(fence);
15261529
if (r < 0)
15271530
return r;
15281531

15291532
if (r == 0)
15301533
break;
1531-
1532-
if (fence->error)
1533-
return fence->error;
15341534
}
15351535

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

0 commit comments

Comments
 (0)