[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260108204019.1870-1-qikeyu2017@gmail.com>
Date: Fri, 9 Jan 2026 04:40:19 +0800
From: Kery Qi <qikeyu2017@...il.com>
To: harry.wentland@....com
Cc: linux-kernel@...r.kernel.org,
Kery Qi <qikeyu2017@...il.com>
Subject: [PATCH] drm/amd/display: dce110: fix NULL deref in dce110_set_backlight_level()
dce110_set_backlight_level() computes controller_id from
pipe_ctx->stream_res.tg->inst before validating that tg is present.
pipe_ctx->stream_res.tg may be NULL on some paths, which can lead to a
NULL pointer dereference (oops/DoS) when setting backlight.
Fix this by requiring tg to be present before accessing tg->inst. Also
check abm->funcs before dereferencing function pointers.
Fixes: 4b0e95d1838f ("drm/amd/display: Add set backlight to hw sequencer.")
Signed-off-by: Kery Qi <qikeyu2017@...il.com>
---
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
index 0cdd8c74abdf..6177bc67ea9c 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
@@ -3263,10 +3263,15 @@ bool dce110_set_backlight_level(struct pipe_ctx *pipe_ctx,
struct panel_cntl *panel_cntl = link->panel_cntl;
struct dmcu *dmcu = dc->res_pool->dmcu;
bool fw_set_brightness = true;
+ struct timing_generator *tg = pipe_ctx->stream_res.tg;
+
+ if (!tg)
+ return false;
+
/* DMCU -1 for all controller id values,
* therefore +1 here
*/
- uint32_t controller_id = pipe_ctx->stream_res.tg->inst + 1;
+ uint32_t controller_id = tg->inst + 1;
if (abm == NULL || panel_cntl == NULL || (abm->funcs->set_backlight_level_pwm == NULL))
return false;
--
2.34.1
Powered by blists - more mailing lists