summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2019-11-06 17:14:45 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-31 16:35:49 +0100
commit2c528fa3c40d16c61da38a9f4fa7a0ce71df4db3 (patch)
tree411e6cabb8dfa6d45c0e75d2b896f1e13cbe98a0 /drivers/gpu/drm
parent7b3fe663da71273710fc8f7fa0c71515e96c6786 (diff)
downloadlinux-stable-2c528fa3c40d16c61da38a9f4fa7a0ce71df4db3.tar.gz
linux-stable-2c528fa3c40d16c61da38a9f4fa7a0ce71df4db3.tar.bz2
linux-stable-2c528fa3c40d16c61da38a9f4fa7a0ce71df4db3.zip
drm/amdgpu: fix potential double drop fence reference
[ Upstream commit 946ab8db6953535a3a88c957db8328beacdfed9d ] 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: Christian König <christian.koenig@amd.com> Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index 8904e62dca7a..41d3142ef3cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -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], &gtt_map);
if (r) {