mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zicheng Qu <quzicheng@huawei.com>
To: <harry.wentland@amd.com>, <sunpeng.li@amd.com>,
	<Rodrigo.Siqueira@amd.com>, <alexander.deucher@amd.com>,
	<christian.koenig@amd.com>, <Xinhui.Pan@amd.com>,
	<airlied@gmail.com>, <simona@ffwll.ch>, <Dillon.Varone@amd.com>,
	<Alvin.Lee2@amd.com>, <nicholas.kazlauskas@amd.com>,
	<alex.hung@amd.com>, <aurabindo.pillai@amd.com>,
	<relja.vojvodic@amd.com>, <chiahsuan.chung@amd.com>,
	<wenjing.liu@amd.com>, <george.shen@amd.com>, <mwen@igalia.com>,
	<yi-lchen@amd.com>, <martin.leung@amd.com>,
	<srinivasan.shanmugam@amd.com>, <stylon.wang@amd.com>,
	<jun.lei@amd.com>, <amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Cc: <tanghui20@huawei.com>, <zhangqiao22@huawei.com>,
	<judy.chenhui@huawei.com>, <quzicheng@huawei.com>
Subject: [PATCH 1/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in dcn20_program_pipe
Date: Tue, 5 Nov 2024 14:01:36 +0000	[thread overview]
Message-ID: <20241105140137.2465572-2-quzicheng@huawei.com> (raw)
In-Reply-To: <20241105140137.2465572-1-quzicheng@huawei.com>

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")
Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
---
 drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
index a80c08582932..36d12db8d022 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
@@ -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 ||
-- 
2.34.1


  reply	other threads:[~2024-11-05 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 14:01 [PATCH 0/2] drm/amd/display: Fix Null Pointer Dereference Issues Zicheng Qu
2024-11-05 14:01 ` Zicheng Qu [this message]
2024-11-14  8:20   ` [PATCH 1/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in dcn20_program_pipe Chung, ChiaHsuan (Tom)
2024-11-05 14:01 ` [PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp Zicheng Qu
2024-11-14  8:16   ` Chung, ChiaHsuan (Tom)
2024-11-18 17:12     ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241105140137.2465572-2-quzicheng@huawei.com \
    --to=quzicheng@huawei.com \
    --cc=Alvin.Lee2@amd.com \
    --cc=Dillon.Varone@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alex.hung@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=george.shen@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=judy.chenhui@huawei.com \
    --cc=jun.lei@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.leung@amd.com \
    --cc=mwen@igalia.com \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=relja.vojvodic@amd.com \
    --cc=simona@ffwll.ch \
    --cc=srinivasan.shanmugam@amd.com \
    --cc=stylon.wang@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=tanghui20@huawei.com \
    --cc=wenjing.liu@amd.com \
    --cc=yi-lchen@amd.com \
    --cc=zhangqiao22@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®