drm/amd/display: Fix writeback job lock evasion within dm_crtc_high_irq

[Why]
Coverity report LOCK_EVASION warning. Access
acrtc->wb_pending without lock wb_conn->job_lock.

[How]
Lock wb_conn->job_lock before accessing
acrtc->wb_pending.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Hersen Wu
2024-04-30 14:24:17 -04:00
committed by Alex Deucher
parent a54f7e866c
commit 922c287782

View File

@@ -597,12 +597,14 @@ static void dm_crtc_high_irq(void *interrupt_params)
if (!acrtc)
return;
if (acrtc->wb_pending) {
if (acrtc->wb_conn) {
spin_lock_irqsave(&acrtc->wb_conn->job_lock, flags);
if (acrtc->wb_conn) {
spin_lock_irqsave(&acrtc->wb_conn->job_lock, flags);
if (acrtc->wb_pending) {
job = list_first_entry_or_null(&acrtc->wb_conn->job_queue,
struct drm_writeback_job,
list_entry);
acrtc->wb_pending = false;
spin_unlock_irqrestore(&acrtc->wb_conn->job_lock, flags);
if (job) {
@@ -620,8 +622,7 @@ static void dm_crtc_high_irq(void *interrupt_params)
acrtc->dm_irq_params.stream, 0);
}
} else
DRM_ERROR("%s: no amdgpu_crtc wb_conn\n", __func__);
acrtc->wb_pending = false;
spin_unlock_irqrestore(&acrtc->wb_conn->job_lock, flags);
}
vrr_active = amdgpu_dm_crtc_vrr_active_irq(acrtc);