Skip to content

Commit b1904ed

Browse files
Wayne Linalexdeucher
authored andcommitted
drm/amd/display: Avoid NULL dereference of timing generator
[Why & How] Check whether assigned timing generator is NULL or not before accessing its funcs to prevent NULL dereference. Reviewed-by: Jun Lei <[email protected]> Acked-by: Hersen Wu <[email protected]> Signed-off-by: Wayne Lin <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent be457b2 commit b1904ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream)
533533
for (i = 0; i < MAX_PIPES; i++) {
534534
struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg;
535535

536-
if (res_ctx->pipe_ctx[i].stream != stream)
536+
if (res_ctx->pipe_ctx[i].stream != stream || !tg)
537537
continue;
538538

539539
return tg->funcs->get_frame_count(tg);
@@ -592,7 +592,7 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
592592
for (i = 0; i < MAX_PIPES; i++) {
593593
struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg;
594594

595-
if (res_ctx->pipe_ctx[i].stream != stream)
595+
if (res_ctx->pipe_ctx[i].stream != stream || !tg)
596596
continue;
597597

598598
tg->funcs->get_scanoutpos(tg,

0 commit comments

Comments
 (0)