[PATCH 2/5] drm/amd/display: Fix null pointer derference in amdgpu_dm_fini()

Mario Limonciello mario.limonciello at amd.com
Fri Nov 15 06:09:21 UTC 2024


Some error cleaning paths call amdgpu_dm_fini() but may not have
initialized `adev->dm.delayed_hpd_wq`. Catch this and avoid
destroying the workqueue.

Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 94f1651422da1..5fd3d36964369 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2219,8 +2219,10 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
 		if (dc_enable_dmub_notifications(adev->dm.dc)) {
 			kfree(adev->dm.dmub_notify);
 			adev->dm.dmub_notify = NULL;
-			destroy_workqueue(adev->dm.delayed_hpd_wq);
-			adev->dm.delayed_hpd_wq = NULL;
+			if (adev->dm.delayed_hpd_wq) {
+				destroy_workqueue(adev->dm.delayed_hpd_wq);
+				adev->dm.delayed_hpd_wq = NULL;
+			}
 		}
 	}
 
-- 
2.43.0



More information about the amd-gfx mailing list