Skip to content

Commit 89939cf

Browse files
Meenakshikumar Somasundaramalexdeucher
authored andcommitted
drm/amd/display: Fix NULL pointer dereference
[Why] On a mst branch with multi display setup, dc context is obselete after updating the first stream. Referencing the same dc context for the next stream update to fetch dc pointer leads to NULL pointer dereference. [How] Get the dc pointer from the link rather than context. Cc: Mario Limonciello <[email protected]> Cc: Alex Deucher <[email protected]> Reviewed-by: Charlene Liu <[email protected]> Signed-off-by: Meenakshikumar Somasundaram <[email protected]> Signed-off-by: Aurabindo Pillai <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit dc69b48988b171d6ccb3a083607e4dff015e2c0d) Cc: [email protected]
1 parent 211ddde commit 89939cf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static void dp_retrain_link_dp_test(struct dc_link *link,
7878
struct audio_output audio_output[MAX_PIPES];
7979
struct dc_stream_state *streams_on_link[MAX_PIPES];
8080
int num_streams_on_link = 0;
81+
struct dc *dc = (struct dc *)link->dc;
8182

8283
needs_divider_update = (link->dc->link_srv->dp_get_encoding_format(link_setting) !=
8384
link->dc->link_srv->dp_get_encoding_format((const struct dc_link_settings *) &link->cur_link_settings));
@@ -150,7 +151,7 @@ static void dp_retrain_link_dp_test(struct dc_link *link,
150151
if (streams_on_link[i] && streams_on_link[i]->link && streams_on_link[i]->link == link) {
151152
stream_update.stream = streams_on_link[i];
152153
stream_update.dpms_off = &dpms_off;
153-
dc_update_planes_and_stream(state->clk_mgr->ctx->dc, NULL, 0, streams_on_link[i], &stream_update);
154+
dc_update_planes_and_stream(dc, NULL, 0, streams_on_link[i], &stream_update);
154155
}
155156
}
156157
}

0 commit comments

Comments
 (0)