Commit 946ab8db authored by Pan Bian's avatar Pan Bian Committed by Alex Deucher

drm/amdgpu: fix potential double drop fence reference

The object fence is not set to NULL after its reference is dropped. As a
result, its reference may be dropped again if error occurs after that,
which may lead to a use after free bug. To avoid the issue, fence is
explicitly set to NULL after dropping its reference.
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f88e2d1f
...@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) ...@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
} }
dma_fence_put(fence); dma_fence_put(fence);
fence = NULL;
r = amdgpu_bo_kmap(vram_obj, &vram_map); r = amdgpu_bo_kmap(vram_obj, &vram_map);
if (r) { if (r) {
...@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) ...@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
} }
dma_fence_put(fence); dma_fence_put(fence);
fence = NULL;
r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map); r = amdgpu_bo_kmap(gtt_obj[i], &gtt_map);
if (r) { if (r) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment