From: Fangzhi Zuo <[email protected]>

[Why & How]
amdgpu_dm_update_freesync_state_on_stream() keyed the VTEM guard off
new_stream->sink->sink_signal, but new_stream->sink can be NULL, leading
to a NULL pointer dereference.

Use new_stream->signal instead, which is a direct field of the already
validated new_stream and carries the same HDMI signal type. This matches
the ALLM block in the same function, which already uses new_stream->signal.

Fixes: fabf2169cb45 ("drm/amd/display: Emit VTEM for HF-VSDB VRR on TMDS links")
Reviewed-by: Tom Chung <[email protected]>
Signed-off-by: Fangzhi Zuo <[email protected]>
Signed-off-by: Ray Wu <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c
index 281c6cec9f4b..e8ae238bbb69 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c
@@ -239,8 +239,8 @@ void amdgpu_dm_update_freesync_state_on_stream(
                pack_sdp_v1_3);
 
        /* Per HDMI 2.1, VTEM is valid on TMDS as well as FRL */
-       if (new_stream->sink->sink_signal == SIGNAL_TYPE_HDMI_FRL ||
-           (new_stream->sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A &&
+       if (new_stream->signal == SIGNAL_TYPE_HDMI_FRL ||
+           (new_stream->signal == SIGNAL_TYPE_HDMI_TYPE_A &&
             aconn && aconn->base.display_info.hdmi.vrr_cap.supported))
                mod_build_infopacket_vtem(new_stream, &vrr_params, 0, 
&vrr_infopacket);
 
-- 
2.43.0

Reply via email to