Skip to contentSkip to conversation

drm/amd/display: Fix potential null dereference

PATCH New Eslam Khafagy 1 participant 3 messages Oct 9, 2025 Stable branch

lore
Share & tools
lore
#0 lore raw

cover drm/amd/display: Fix potential null dereference

This series backports commit [52f1783ff414 ("drm/amd/display: Fix potential null dereference")] to stable branch 5.10.y. However to apply this i had to backport commit [3beac533b8da ("drm/amd/display: Remove redundant safeguards for dmub-srv destroy()")] first.

Igor Artemiev (1):
drm/amd/display: Fix potential null dereference

Roman Li (1):
drm/amd/display: Remove redundant safeguards for dmub-srv destroy()

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--
2.43.0

#1 lore raw

PATCH 1/2 drm/amd/display: Remove redundant safeguards for dmub-srv destroy()

From: Roman Li <[email protected]>

[ Upstream commit 3beac533b8daa18358dabbe5059c417d192b2a93 ]

[Why]
dc_dmub_srv_destroy() has internal null-check and null assignment. No need to duplicate them externally.

[How]
Remove redundant safeguards.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -4
index 45420968e5f1..b698d652d41f 100644
@@ -1141,10 +1141,8 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
 	if (adev->dm.dc)
 		dc_deinit_callbacks(adev->dm.dc);
 #endif
-	if (adev->dm.dc->ctx->dmub_srv) {
-		dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-		adev->dm.dc->ctx->dmub_srv = NULL;
-	}
+
+	dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
 
 	if (adev->dm.dmub_bo)
 		amdgpu_bo_free_kernel(&adev->dm.dmub_bo,
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 drm/amd/display: Fix potential null dereference

In reply to Eslam Khafagy

From: Igor Artemiev <[email protected]>

[ Upstream commit 52f1783ff4146344342422c1cd94fcb4ce39b6fe ]

The adev->dm.dc pointer can be NULL and dereferenced in amdgpu_dm_fini() without checking.

Add a NULL pointer check before calling dc_dmub_srv_destroy().

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

Fixes 9a71c7d31734 ("drm/amd/display: Register DMUB service with DC")
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index b698d652d41f..0aa681939b7e 100644
@@ -1142,7 +1142,8 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
 		dc_deinit_callbacks(adev->dm.dc);
 #endif
 
-	dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
+	if (adev->dm.dc)
+		dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
 
 	if (adev->dm.dmub_bo)
 		amdgpu_bo_free_kernel(&adev->dm.dmub_bo,
Signature · 1 line
2.43.0