[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_54FF4252EDFB6533090A491A25EEF3EDBF06@qq.com>
Date: Fri, 4 Jul 2025 11:16:22 +0800
From: jackysliu <1972843537@...com>
To: harry.wentland@....com
Cc: 1972843537@...com,
Austin.Zheng@....com,
Dillon.Varone@....com,
Security@...cent.com,
Sung.Lee@....com,
Wayne.Lin@....com,
airlied@...il.com,
alexander.deucher@....com,
alvin.lee2@....com,
amd-gfx@...ts.freedesktop.org,
aurabindo.pillai@....com,
christian.koenig@....com,
dri-devel@...ts.freedesktop.org,
joshua.aberback@....com,
linux-kernel@...r.kernel.org,
linux@...blig.org,
mario.limonciello@....com,
ryanseto@....com,
simona@...ll.ch,
siqueira@...lia.com,
sunpeng.li@....com
Subject: [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability
From: jackysliu <Security@...cent.com>
A null pointer dereference vulnerability exists in the AMD display driver's
(DC module) cleanup function dc_destruct().
When display control context (dc->ctx) construction fails
(due to memory allocation failure), this pointer remains NULL.
During subsequent error handling when dc_destruct() is called,
there's no NULL check before dereferencing the perf_trace member
(dc->ctx->perf_trace),
causing a kernel null pointer dereference crash
Signed-off-by: jackysliu <Security@...cent.com>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 56d011a1323c..393f87cfe74d 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -934,17 +934,21 @@ static void dc_destruct(struct dc *dc)
if (dc->link_srv)
link_destroy_link_service(&dc->link_srv);
- if (dc->ctx->gpio_service)
- dal_gpio_service_destroy(&dc->ctx->gpio_service);
+ if (!dc->ctx) {
+ dm_error("%s: called with NULL ctx\n", __func__);
+ } else {
+ if (dc->ctx->gpio_service)
+ dal_gpio_service_destroy(&dc->ctx->gpio_service);
- if (dc->ctx->created_bios)
- dal_bios_parser_destroy(&dc->ctx->dc_bios);
+ if (dc->ctx->created_bios)
+ dal_bios_parser_destroy(&dc->ctx->dc_bios);
- kfree(dc->ctx->logger);
- dc_perf_trace_destroy(&dc->ctx->perf_trace);
+ kfree(dc->ctx->logger);
+ dc_perf_trace_destroy(&dc->ctx->perf_trace);
- kfree(dc->ctx);
- dc->ctx = NULL;
+ kfree(dc->ctx);
+ dc->ctx = NULL;
+ }
kfree(dc->bw_vbios);
dc->bw_vbios = NULL;
--
2.43.5
Powered by blists - more mailing lists