Skip to content

Commit e7650e3

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 <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: Ronnie Sahlberg <rsahlberg@ciq.com>
1 parent 2a51943 commit e7650e3

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
@@ -1500,15 +1500,15 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
15001500
continue;
15011501

15021502
r = dma_fence_wait_timeout(fence, true, timeout);
1503+
if (r > 0 && fence->error)
1504+
r = fence->error;
1505+
15031506
dma_fence_put(fence);
15041507
if (r < 0)
15051508
return r;
15061509

15071510
if (r == 0)
15081511
break;
1509-
1510-
if (fence->error)
1511-
return fence->error;
15121512
}
15131513

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

0 commit comments

Comments
 (0)