drm/amdgpu: fix potential double drop fence reference
authorPan Bian <bianpan2016@163.com>
Wed, 6 Nov 2019 09:14:45 +0000 (17:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:45:00 +0000 (16:45 +0100)
commit7f4402438463b25b3fd754e0c9d5f92d408ab127
treed693ce788c21bc07c6328a764db394954e751a7d
parent0e8aeefb97c00a50921d95d49a48d8395ffdb5b8
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c