drm/amd/display: Fix Null Pointer Dereference Issues
Subsystems (3)
cover drm/amd/display: Fix Null Pointer Dereference Issues
Hi all,
I am submitting two patches to fix null pointer dereference issues in the AMD display driver.
1. Patch 1/2 (Fixes: 8e4ed3cf1642): Add null checks in dcn20_program_pipe() to prevent potential crashes when accessing plane_state.
2. Patch 2/2 (Fixes: 0baae6246307): Ensures pipe_ctx->plane_state is checked in hwss_setup_dpp() to improve function stability.
Thanks for reviewing!
Zicheng Qu (2):
drm/amd/display: Fix null check for pipe_ctx->plane_state in
dcn20_program_pipe
drm/amd/display: Fix null check for pipe_ctx->plane_state in
hwss_setup_dpp
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 3 +++ drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 drm/amd/display: Fix null check for pipe_ctx->plane_state in dcn20_program_pipe
This commit addresses a null pointer dereference issue in dcn20_program_pipe(). Previously, commit 8e4ed3cf1642 ("drm/amd/display:
Add null check for pipe_ctx->plane_state in dcn20_program_pipe") partially fixed the null pointer dereference issue. However, in dcn20_update_dchubp_dpp(), the variable pipe_ctx is passed in, and plane_state is accessed again through pipe_ctx. Multiple if statements directly call attributes of plane_state, leading to potential null pointer dereference issues. This patch adds necessary null checks to ensure stability.
--- drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +3 -3
@@ -1923,9 +1923,9 @@ static void dcn20_program_pipe( dc->res_pool->hubbub, pipe_ctx->plane_res.hubp->inst, pipe_ctx->hubp_regs.det_size); } -if (pipe_ctx->update_flags.raw || - (pipe_ctx->plane_state && pipe_ctx->plane_state->update_flags.raw) || - pipe_ctx->stream->update_flags.raw) +if (pipe_ctx->plane_state && (pipe_ctx->update_flags.raw || + pipe_ctx->plane_state->update_flags.raw || + pipe_ctx->stream->update_flags.raw))dcn20_update_dchubp_dpp (dc, pipe_ctx, context); if (pipe_ctx->plane_state && (pipe_ctx->update_flags.bits.enable ||
Signature · 1 line
2.34.1
Re: [PATCH 1/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in dcn20_program_pipe
Quoted 33 lines · Zicheng Qu
This commit addresses a null pointer dereference issue in
dcn20_program_pipe(). Previously, commit8e4ed3cf1642("drm/amd/display:
Add null check forpipe_ctx->plane_stateindcn20_program_pipe") partially fixed the null pointer dereference issue. However, indcn20_update_dchubp_dpp(), the variablepipe_ctxis passed in, andplane_stateis accessed again throughpipe_ctx. Multiple if statements directly call attributes ofplane_state, leading to potential null pointer dereference issues. This patch adds necessary null checks to ensure stability.Fixes 8e4ed3cf1642 ("drm/amd/display: Add null check for pipe_ctx->plane_state in dcn20_program_pipe")Signed-off-by Zicheng Qu <[email protected]>--- drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +3
-3@@ -1923,9 +1923,9 @@ static void dcn20_program_pipe( dc->res_pool->hubbub, pipe_ctx->plane_res.hubp->inst, pipe_ctx->hubp_regs.det_size); } -if (pipe_ctx->update_flags.raw || - (pipe_ctx->plane_state && pipe_ctx->plane_state->update_flags.raw) || - pipe_ctx->stream->update_flags.raw) +if (pipe_ctx->plane_state && (pipe_ctx->update_flags.raw || + pipe_ctx->plane_state->update_flags.raw || + pipe_ctx->stream->update_flags.raw))dcn20_update_dchubp_dpp (dc, pipe_ctx, context); if (pipe_ctx->plane_state && (pipe_ctx->update_flags.bits.enable ||
PATCH 2/2 drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp
In reply to Zicheng QuThis commit addresses a null pointer dereference issue in hwss_setup_dpp(). The issue could occur when pipe_ctx->plane_state is null. The fix adds a check to ensure pipe_ctx->plane_state is not null before accessing. This prevents a null pointer dereference.
--- drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +3 -0
@@ -881,6 +881,9 @@ void hwss_setup_dpp(union block_sequence_params *params)struct dpp *dpp = pipe_ctx->plane_res.dpp;struct dc_plane_state *plane_state = pipe_ctx->plane_state; +if (!plane_state) +return ; +if (dpp && dpp->funcs->dpp_setup) {// program the input csc dpp->funcs->dpp_setup(dpp,
Signature · 1 line
2.34.1
Re: [PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp
Quoted 25 lines · Zicheng Qu
This commit addresses a null pointer dereference issue in
hwss_setup_dpp(). The issue could occur whenpipe_ctx->plane_stateis null. The fix adds a check to ensurepipe_ctx->plane_stateis not null before accessing. This prevents a null pointer dereference.Fixes 0baae6246307 ("drm/amd/display: Refactor fast update to use new HWSS build sequence")Signed-off-by Zicheng Qu <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +3
-0@@ -881,6 +881,9 @@ void hwss_setup_dpp(union block_sequence_params *params)struct dpp *dpp = pipe_ctx->plane_res.dpp;struct dc_plane_state *plane_state = pipe_ctx->plane_state; +if (!plane_state) +return ; +if (dpp && dpp->funcs->dpp_setup) {// program the input csc dpp->funcs->dpp_setup(dpp,
Re: [PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp
Applied both.
Thanks!
Alex
Quoted 29 lines · ChiaHsuan (Tom)
Reviewed-by Tom Chung <[email protected]>Quoted 25 lines · Zicheng Qu
This commit addresses a null pointer dereference issue in
hwss_setup_dpp(). The issue could occur whenpipe_ctx->plane_stateis null. The fix adds a check to ensurepipe_ctx->plane_stateis not null before accessing. This prevents a null pointer dereference.Fixes 0baae6246307 ("drm/amd/display: Refactor fast update to use new HWSS build sequence")Signed-off-by Zicheng Qu <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +3
-0@@ -881,6 +881,9 @@ void hwss_setup_dpp(union block_sequence_params *params)struct dpp *dpp = pipe_ctx->plane_res.dpp;struct dc_plane_state *plane_state = pipe_ctx->plane_state; +if (!plane_state) +return ; +if (dpp && dpp->funcs->dpp_setup) {// program the input csc dpp->funcs->dpp_setup(dpp,
Hi,
Gentle ping.
The patch link is: [PATCH 0/2] drm/amd/display: Fix Null Pointer Dereference Issues - Zicheng Qu (kernel.org) <https://lore.kernel.org/linux-kernel/[email protected]/>
Best regards,
Zicheng
Quoted 24 lines · Zicheng Qu
Hi all,
I am submitting two patches to fix null pointer dereference issues in the AMD display driver.
1. Patch 1/2 (Fixes:
8e4ed3cf1642): Add null checks indcn20_program_pipe()to prevent potential crashes when accessingplane_state.2. Patch 2/2 (Fixes:
0baae6246307): Ensurespipe_ctx->plane_stateis checked inhwss_setup_dpp()to improve function stability.Thanks for reviewing!
Zicheng Qu (2):
drm/amd/display: Fix null check forpipe_ctx->plane_statein
dcn20_program_pipe
drm/amd/display: Fix null check forpipe_ctx->plane_statein
hwss_setup_dppdrivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 3 +++ drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)