Skip to content

Commit 33bb639

Browse files
Nicholas Kazlauskasalexdeucher
authored andcommitted
drm/amd/display: Fix USB4 null pointer dereference in update_psp_stream_config
[Why] A porting error on a previous patch left the block of code that causes the crash from a NULL pointer dereference. More specifically, we try to access link_enc before it's assigned in the USB4 case in the following assignment: config.dio_output_idx = link_enc->transmitter - TRANSMITTER_UNIPHY_A; [How] That assignment occurs later depending on the ASIC version. It's only needed on DCN31 and only after link_enc is already assigned. Fixes: 9864304 ("drm/amd/display: fix a crash on USB4 over C20 PHY") Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Nicholas Kazlauskas <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 33735c1 commit 33bb639

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/gpu/drm/amd/display/dc/core/dc_link.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3945,12 +3945,9 @@ static void update_psp_stream_config(struct pipe_ctx *pipe_ctx, bool dpms_off)
39453945
config.dig_be = pipe_ctx->stream->link->link_enc_hw_inst;
39463946
#if defined(CONFIG_DRM_AMD_DC_DCN)
39473947
config.stream_enc_idx = pipe_ctx->stream_res.stream_enc->id - ENGINE_ID_DIGA;
3948-
3948+
39493949
if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_PHY ||
39503950
pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) {
3951-
link_enc = pipe_ctx->stream->link->link_enc;
3952-
config.dio_output_type = pipe_ctx->stream->link->ep_type;
3953-
config.dio_output_idx = link_enc->transmitter - TRANSMITTER_UNIPHY_A;
39543951
if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_PHY)
39553952
link_enc = pipe_ctx->stream->link->link_enc;
39563953
else if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA)

0 commit comments

Comments
 (0)