Skip to content

Commit e9aeb82

Browse files
drm/amdgpu: Fix potential fence use-after-free v2
jira VULN-7613 cve CVE-2023-51042 commit-author shanzhulig <shanzhulig@gmail.com> 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> (cherry picked from commit 2e54154) Signed-off-by: Pratham Patel <ppatel@ciq.com>
1 parent c422529 commit e9aeb82

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
@@ -1502,15 +1502,15 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
15021502
continue;
15031503

15041504
r = dma_fence_wait_timeout(fence, true, timeout);
1505+
if (r > 0 && fence->error)
1506+
r = fence->error;
1507+
15051508
dma_fence_put(fence);
15061509
if (r < 0)
15071510
return r;
15081511

15091512
if (r == 0)
15101513
break;
1511-
1512-
if (fence->error)
1513-
return fence->error;
15141514
}
15151515

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

0 commit comments

Comments
 (0)