diff mbox series

[lvc-project] drm/amd/display: Fix potential null dereference

Message ID 20230929153345.34112-1-Igor.A.Artemiev@mcst.ru (mailing list archive)
State New, archived
Headers show
Series [lvc-project] drm/amd/display: Fix potential null dereference | expand

Commit Message

Igor Artemiev Sept. 29, 2023, 3:33 p.m. UTC
The 'top_pipe_to_program pointer' can be NULL and it is checked 
at the first dereference, but not at the second. 

Add a check before using it.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 3a9077b60029..154ad23ff931 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -3824,7 +3824,8 @@  static void commit_planes_for_stream(struct dc *dc,
 	}
 
 	if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed)
-		if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {
+		if (top_pipe_to_program &&
+				top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {
 			top_pipe_to_program->stream_res.tg->funcs->wait_for_state(
 				top_pipe_to_program->stream_res.tg,
 				CRTC_STATE_VACTIVE);