aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorshanzhulig <[email protected]>2023-06-28 01:10:47 +0000
committerAlex Deucher <[email protected]>2023-06-30 17:12:16 +0000
commit2e54154b9f27262efd0cb4f903cc7d5ad1fe9628 (patch)
treef5437b73169a7273988e8a834b5ec41576b279df /drivers/gpu
parentdrm/amd/pm: avoid unintentional shutdown due to temperature momentary fluctua... (diff)
downloadkernel-2e54154b9f27262efd0cb4f903cc7d5ad1fe9628.tar.gz
kernel-2e54154b9f27262efd0cb4f903cc7d5ad1fe9628.zip
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]>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index b34f9f8d33d2..040f4cb6ab2d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1654,15 +1654,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));