From: Fangzhi Zuo <[email protected]> [Why] The HDMI FRL status polling work re-queues itself and its workqueue was not stopped during amdgpu_dm_fini(). During unbind or unload, the worker could access freed DC state, and the workqueue was leaked. This fixes the FRL polling teardown introduced by the HDMI FRL support change.
[How] Cancel the delayed polling work synchronously and destroy the workqueue in amdgpu_dm_fini() before the remaining display state is torn down. Cc: Harry Wentland <[email protected]> Signed-off-by: Fangzhi Zuo <[email protected]> Signed-off-by: Wayne Lin <[email protected]> --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 7fffbb609225..a7c2b0094944 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -885,6 +885,13 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) adev->dm.vblank_control_workqueue = NULL; } + /* The poll re-queues itself, so stop it before the wq and dc go away. */ + if (adev->dm.hdmi_frl_status_polling_wq) { + cancel_delayed_work_sync(&adev->dm.hdmi_frl_status_polling_work); + destroy_workqueue(adev->dm.hdmi_frl_status_polling_wq); + adev->dm.hdmi_frl_status_polling_wq = NULL; + } + if (adev->dm.idle_workqueue) { if (adev->dm.idle_workqueue->running) { adev->dm.idle_workqueue->enable = false; -- 2.43.0
