From: Dyllan Kobal <[email protected]>

The SST DP-HDMI PCON branch of dm_helpers_dp_write_dsc_enable() logs
through (port->passthrough_aux), but `port` is only assigned inside
the SIGNAL_TYPE_DISPLAY_PORT_MST branch above. On a SST link with a
DP-HDMI protocol converter, `port` is read uninitialized, producing
a null dereference when the driver enables DSC over a SST DP-HDMI PCON link:

  BUG: kernel NULL pointer dereference, address: 0000000000000570
  RIP: dm_helpers_dp_write_dsc_enable+0x453/0x620 [amdgpu]
  Call Trace:
    link_set_dpms_on
    dce110_apply_single_controller_ctx_to_hw
    ...
    amdgpu_dm_atomic_commit_tail

Replace the (port->passthrough_aux) selector in the debug message with
a check on the local enable_dsc, which is always valid here. No
functional change on the wire; the DPCD write below is unchanged.

Signed-off-by: Dyllan Kobal <[email protected]>
---
Reproduced with a Sony Bravia 8 II via a UGREEN unidirectional DP 1.4 to HDMI 
2.1 8K@60Hz active adapter on a Radeon RX 9070 XT.

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 83034b0236c6..b55b1719892e 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -973,10 +973,10 @@ bool dm_helpers_dp_write_dsc_enable(
                                        enable_dsc = DSC_DECODING;
                                }
                                drm_dbg_dp(dev,
-                                         "SST_DSC Sent DSC decoding enable to 
%s port, ret = %u\n",
-                                         (port->passthrough_aux) ?
-                                         "remote HDMI FRL RX" :
-                                         "DP-HDMI PCON", ret);
+                                         "SST_DSC Sent DSC %s to DP-HDMI PCON, 
ret = %u\n",
+                                         (enable_dsc == DSC_PASSTHROUGH) ?
+                                         "passthrough enable" :
+                                         "decoding enable", ret);
                        } else {
                                enable_dsc = DSC_DISABLE;
                                drm_dbg_dp(dev, "SST_DSC Send DSC disable to 
DP-HDMI PCON\n");
-- 
2.54.0

Reply via email to