]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: Fix null check for pipe_ctx->plane_state in dcn20_program_pipe
authorZicheng Qu <quzicheng@huawei.com>
Tue, 5 Nov 2024 14:01:36 +0000 (14:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:05 +0000 (13:54 +0100)
[ Upstream commit 6a057072ddd127255350357dd880903e8fa23f36 ]

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.

Fixes: 8e4ed3cf1642 ("drm/amd/display: Add null check for pipe_ctx->plane_state in dcn20_program_pipe")
Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c

index 936c0ec076bc4cdfaff62d900ea088873125b51b..18c1e529249963cee9c5fa77b11411fbb8d6d924 100644 (file)
@@ -1922,9 +1922,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->update_flags.bits.enable ||