From: Kery Qi <qikeyu2017@gmail.com>
To: harry.wentland@amd.com
Cc: linux-kernel@vger.kernel.org, Kery Qi <qikeyu2017@gmail.com>
Subject: [PATCH] drm/amd/display: dcn21: fix NULL deref in abm immediate disable
Date: Fri, 9 Jan 2026 04:23:29 +0800 [thread overview]
Message-ID: <20260108202330.1849-1-qikeyu2017@gmail.com> (raw)
dcn21_set_abm_immediate_disable() dereferenced pipe_ctx->stream_res.tg
unconditionally to read tg->inst. pipe_ctx->stream_res.tg may be NULL
on some paths, and the function can still be reached when abm_level is
non-zero, leading to a NULL pointer dereference (oops/DoS).
Fix this by requiring abm, tg and panel_cntl to be present before
accessing tg->inst and issuing ABM/panel operations.
This is similar to CVE-2024-26661.
Fixes: 474ac4a875ca ("drm/amd/display: Implement some asic specific abm call backs.")
Signed-off-by: Kery Qi <qikeyu2017@gmail.com>
---
.../amd/display/dc/hwss/dcn21/dcn21_hwseq.c | 31 +++++++++++--------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c
index e2269211553c..66d5c18e9a9e 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c
@@ -179,7 +179,7 @@ static void dmub_abm_set_backlight(struct dc_context *dc, uint32_t backlight_pwm
void dcn21_set_abm_immediate_disable(struct pipe_ctx *pipe_ctx)
{
struct abm *abm = pipe_ctx->stream_res.abm;
- uint32_t otg_inst = pipe_ctx->stream_res.tg->inst;
+ struct timing_generator *tg = pipe_ctx->stream_res.tg;
struct panel_cntl *panel_cntl = pipe_ctx->stream->link->panel_cntl;
struct dmcu *dmcu = pipe_ctx->stream->ctx->dc->res_pool->dmcu;
@@ -189,24 +189,29 @@ void dcn21_set_abm_immediate_disable(struct pipe_ctx *pipe_ctx)
return;
}
+ uint32_t otg_inst;
+
+ if (!abm || !tg || !panel_cntl)
+ return;
+
+ otg_inst = tg->inst;
+
if (dmcu) {
dce110_set_abm_immediate_disable(pipe_ctx);
return;
}
- if (abm && panel_cntl) {
- if (abm->funcs && abm->funcs->set_pipe_ex) {
- abm->funcs->set_pipe_ex(abm, otg_inst, SET_ABM_PIPE_IMMEDIATELY_DISABLE,
- panel_cntl->inst, panel_cntl->pwrseq_inst);
- } else {
- dcn21_dmub_abm_set_pipe(abm,
- otg_inst,
- SET_ABM_PIPE_IMMEDIATELY_DISABLE,
- panel_cntl->inst,
- panel_cntl->pwrseq_inst);
- }
- panel_cntl->funcs->store_backlight_level(panel_cntl);
+ if (abm->funcs && abm->funcs->set_pipe_ex) {
+ abm->funcs->set_pipe_ex(abm, otg_inst, SET_ABM_PIPE_IMMEDIATELY_DISABLE,
+ panel_cntl->inst, panel_cntl->pwrseq_inst);
+ } else {
+ dcn21_dmub_abm_set_pipe(abm,
+ otg_inst,
+ SET_ABM_PIPE_IMMEDIATELY_DISABLE,
+ panel_cntl->inst,
+ panel_cntl->pwrseq_inst);
}
+ panel_cntl->funcs->store_backlight_level(panel_cntl);
}
void dcn21_set_pipe(struct pipe_ctx *pipe_ctx)
--
2.34.1
reply other threads:[~2026-01-08 20:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260108202330.1849-1-qikeyu2017@gmail.com \
--to=qikeyu2017@gmail.com \
--cc=harry.wentland@amd.com \
--cc=linux-kernel@vger.kernel.org \
/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®