]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
authorNikita Zhandarovich <n.zhandarovich@fintech.ru>
Tue, 6 Feb 2024 16:50:56 +0000 (08:50 -0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:47 +0000 (18:19 -0400)
commite040f1fbe9abae91b12b074cfc3bbb5367b79811
treeac882aff69993879b860193e617d45ce79e93c39
parent6fc5fb8ebef803285a8f71e298e8a658d836a492
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()

[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]

Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
there.

Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
Clean up by combining them all under one 'if'.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c