drm/amdgpu: fix potential double drop fence reference
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +2 -0
@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (vram_obj, &vram_map);if (r) {
@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (gtt_obj[i], >t_map);if (r) {
Signature · 1 line
2.7.4
Am 06.11.19 um 10:14 schrieb Pan Bian:
Quoted 6 lines
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.
Signed-off-by Pan Bian <[email protected]>
Quoted 24 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +2
-0@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (vram_obj, &vram_map);if (r) {@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (gtt_obj[i], >t_map);if (r) {
Alex Deucher
AppliedQuoted 10 lines · Christian
Am 06.11.19 um 10:14 schrieb Pan Bian:
Quoted 6 lines
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.
Signed-off-by Pan Bian <[email protected]>Acked-by Christian König <[email protected]>
Applied. thanks!
Alex
Quoted 23 lines
Quoted 23 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +2
-0@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (vram_obj, &vram_map);if (r) {@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ;
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c static void amdgpu_do_test_moves(struct amdgpu_device *adev) · line 190
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +0
-0r =amdgpu_bo_kmap (gtt_obj[i], >t_map);if (r) {_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel