mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 16:49:22 +00:00
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 <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>
This commit is contained in:
parent
b75efe88b2
commit
2e54154b9f
1 changed files with 3 additions and 3 deletions
|
@ -1654,15 +1654,15 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = dma_fence_wait_timeout(fence, true, timeout);
|
r = dma_fence_wait_timeout(fence, true, timeout);
|
||||||
|
if (r > 0 && fence->error)
|
||||||
|
r = fence->error;
|
||||||
|
|
||||||
dma_fence_put(fence);
|
dma_fence_put(fence);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (fence->error)
|
|
||||||
return fence->error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(wait, 0, sizeof(*wait));
|
memset(wait, 0, sizeof(*wait));
|
||||||
|
|
Loading…
Reference in a new issue