* [PATCH] drm/amd/display:fix a Null pointer dereference vulnerability
@ 2025-07-03 3:39 jackysliu
2025-07-03 15:15 ` Harry Wentland
0 siblings, 1 reply; 8+ messages in thread
From: jackysliu @ 2025-07-03 3:39 UTC (permalink / raw)
To: harry.wentland
Cc: sunpeng.li, siqueira, alexander.deucher, christian.koenig,
airlied, simona, alvin.lee2, aurabindo.pillai, Dillon.Varone,
Austin.Zheng, Sung.Lee, mario.limonciello, Wayne.Lin, ryanseto,
linux, joshua.aberback, amd-gfx, dri-devel, linux-kernel,
jackysliu, jackysliu
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@tencent.com>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 56d011a1323c..3bda0593f66f 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -934,6 +934,11 @@ static void dc_destruct(struct dc *dc)
if (dc->link_srv)
link_destroy_link_service(&dc->link_srv);
+ if (!dc->ctx) {
+ dm_error("%s: called with NULL ctx\n", __func__);
+ goto skip_ctx_cleanup;
+ }
+
if (dc->ctx->gpio_service)
dal_gpio_service_destroy(&dc->ctx->gpio_service);
@@ -946,6 +951,7 @@ static void dc_destruct(struct dc *dc)
kfree(dc->ctx);
dc->ctx = NULL;
+skip_ctx_cleanup:
kfree(dc->bw_vbios);
dc->bw_vbios = NULL;
--
2.43.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/amd/display:fix a Null pointer dereference vulnerability
2025-07-03 3:39 [PATCH] drm/amd/display:fix a Null pointer dereference vulnerability jackysliu
@ 2025-07-03 15:15 ` Harry Wentland
2025-07-04 3:11 ` jackysliu
2025-07-04 3:16 ` [PATCH v2] " jackysliu
0 siblings, 2 replies; 8+ messages in thread
From: Harry Wentland @ 2025-07-03 15:15 UTC (permalink / raw)
To: jackysliu
Cc: sunpeng.li, siqueira, alexander.deucher, christian.koenig,
airlied, simona, alvin.lee2, aurabindo.pillai, Dillon.Varone,
Austin.Zheng, Sung.Lee, mario.limonciello, Wayne.Lin, ryanseto,
linux, joshua.aberback, amd-gfx, dri-devel, linux-kernel,
jackysliu
On 2025-07-02 23:39, jackysliu wrote:
> 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@tencent.com>
Thanks for your patch.
Please run and fix this checkpatch.pl warning:
WARNING: From:/Signed-off-by: email address mismatch: 'From: jackysliu <1972843537@qq.com>' != 'Signed-off-by: jackysliu <Security@tencent.com>'
> ---
> drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index 56d011a1323c..3bda0593f66f 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -934,6 +934,11 @@ static void dc_destruct(struct dc *dc)
> if (dc->link_srv)
> link_destroy_link_service(&dc->link_srv);
>
> + if (!dc->ctx) {
> + dm_error("%s: called with NULL ctx\n", __func__);
> + goto skip_ctx_cleanup;
> + }
> +
I would prefer to simply wrap the dc->ctx->logger and dc->ctx bits
with if (!dc->ctx) and avoid the goto.
Harry
> if (dc->ctx->gpio_service)
> dal_gpio_service_destroy(&dc->ctx->gpio_service);
>
> @@ -946,6 +951,7 @@ static void dc_destruct(struct dc *dc)
> kfree(dc->ctx);
> dc->ctx = NULL;
>
> +skip_ctx_cleanup:
> kfree(dc->bw_vbios);
> dc->bw_vbios = NULL;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE:[PATCH] drm/amd/display:fix a Null pointer dereference vulnerability
2025-07-03 15:15 ` Harry Wentland
@ 2025-07-04 3:11 ` jackysliu
2025-07-04 3:16 ` [PATCH v2] " jackysliu
1 sibling, 0 replies; 8+ messages in thread
From: jackysliu @ 2025-07-04 3:11 UTC (permalink / raw)
To: harry.wentland
Cc: 1972843537, Austin.Zheng, Dillon.Varone, Security, Sung.Lee,
Wayne.Lin, airlied, alexander.deucher, alvin.lee2, amd-gfx,
aurabindo.pillai, christian.koenig, dri-devel, joshua.aberback,
linux-kernel, linux, mario.limonciello, ryanseto, simona,
siqueira, sunpeng.li
On 2025-07-03 11:15, Harry Wentland wrote
>Thanks for your patch.
>
>Please run and fix this checkpatch.pl warning:
>
>WARNING: From:/Signed-off-by: email address mismatch: 'From: jackysliu <1972843537@qq.com>' != 'Signed-off-by: jackysliu <Security@tencent.com>'
>I would prefer to simply wrap the dc->ctx->logger and dc->ctx bits
>with if (!dc->ctx) and avoid the goto.
Thank you Harry, for the patient review. I'll submit a revised patch later.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability
2025-07-03 15:15 ` Harry Wentland
2025-07-04 3:11 ` jackysliu
@ 2025-07-04 3:16 ` jackysliu
2025-07-15 10:44 ` Krzysztof Kozlowski
1 sibling, 1 reply; 8+ messages in thread
From: jackysliu @ 2025-07-04 3:16 UTC (permalink / raw)
To: harry.wentland
Cc: 1972843537, Austin.Zheng, Dillon.Varone, Security, Sung.Lee,
Wayne.Lin, airlied, alexander.deucher, alvin.lee2, amd-gfx,
aurabindo.pillai, christian.koenig, dri-devel, joshua.aberback,
linux-kernel, linux, mario.limonciello, ryanseto, simona,
siqueira, sunpeng.li
From: jackysliu <Security@tencent.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@tencent.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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability
2025-07-04 3:16 ` [PATCH v2] " jackysliu
@ 2025-07-15 10:44 ` Krzysztof Kozlowski
2025-07-15 21:29 ` Mario Limonciello
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-15 10:44 UTC (permalink / raw)
To: jackysliu, harry.wentland
Cc: Austin.Zheng, Dillon.Varone, Security, Sung.Lee, Wayne.Lin,
airlied, alexander.deucher, alvin.lee2, amd-gfx, aurabindo.pillai,
christian.koenig, dri-devel, joshua.aberback, linux-kernel, linux,
mario.limonciello, ryanseto, simona, siqueira, sunpeng.li
On 04/07/2025 05:16, jackysliu wrote:
> From: jackysliu <Security@tencent.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@tencent.com>
> ---
> drivers/gpu/drm/amd/display/dc/core/dc.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
You should disclose that you used some AI tool for that... and that
other report(s) was really fake finding. People should know you
generated it with AI, so they could make informed decision whether to
even allocate time here.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability
2025-07-15 10:44 ` Krzysztof Kozlowski
@ 2025-07-15 21:29 ` Mario Limonciello
2025-07-16 3:10 ` [PATCH] scsi:bfa: Double-free vulnerability fix jackysliu
2025-07-16 3:37 ` [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability jackysliu
2 siblings, 0 replies; 8+ messages in thread
From: Mario Limonciello @ 2025-07-15 21:29 UTC (permalink / raw)
To: Krzysztof Kozlowski, jackysliu, harry.wentland
Cc: Austin.Zheng, Dillon.Varone, Security, Sung.Lee, Wayne.Lin,
airlied, alexander.deucher, alvin.lee2, amd-gfx, aurabindo.pillai,
christian.koenig, dri-devel, joshua.aberback, linux-kernel, linux,
ryanseto, simona, siqueira, sunpeng.li
On 7/15/2025 5:44 AM, Krzysztof Kozlowski wrote:
> On 04/07/2025 05:16, jackysliu wrote:
>> From: jackysliu <Security@tencent.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@tencent.com>
>> ---
>> drivers/gpu/drm/amd/display/dc/core/dc.c | 20 ++++++++++++--------
>> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> You should disclose that you used some AI tool for that... and that
> other report(s) was really fake finding. People should know you
> generated it with AI, so they could make informed decision whether to
> even allocate time here.
>
> Best regards,
> Krzysztof
Failure paths are so rarely executed that it sometimes takes years or
static analyzers to find and fix issues.
In this case I think it's a real problem. During init the following
sequence happens:
dc_create()
->dc_construct_ctx()
If dc_construct_ctx() fails then it jumps to a label that calls
dc_destruct(). So if the context wasn't set up then yeah there could be
a NULL pointer deref.
So to me this makes sense.
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Harry, do you agree?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] scsi:bfa: Double-free vulnerability fix
2025-07-15 10:44 ` Krzysztof Kozlowski
2025-07-15 21:29 ` Mario Limonciello
@ 2025-07-16 3:10 ` jackysliu
2025-07-16 3:37 ` [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability jackysliu
2 siblings, 0 replies; 8+ messages in thread
From: jackysliu @ 2025-07-16 3:10 UTC (permalink / raw)
To: krzk
Cc: 1972843537, Austin.Zheng, Dillon.Varone, Security, Sung.Lee,
Wayne.Lin, airlied, alexander.deucher, alvin.lee2, amd-gfx,
aurabindo.pillai, christian.koenig, dri-devel, harry.wentland,
joshua.aberback, linux-kernel, linux, mario.limonciello, ryanseto,
simona, siqueira, sunpeng.li
On Tue, Jul 15 2025 12:45:00 +0200 Krzysztof Kozlowski wrote:
>You should disclose that you used some AI tool for that... and that
>other report(s) was really fake finding. People should know you
>generated it with AI, so they could make informed decision whether to
>even allocate time here.
Although this problem was detected with the help of ai and static methods,
I checked the trigger path by myself and verified this problem.
I'll describe the ways of detection if I find other issues in the future.
Anyway, thanks for your review.
Siyang Liu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability
2025-07-15 10:44 ` Krzysztof Kozlowski
2025-07-15 21:29 ` Mario Limonciello
2025-07-16 3:10 ` [PATCH] scsi:bfa: Double-free vulnerability fix jackysliu
@ 2025-07-16 3:37 ` jackysliu
2 siblings, 0 replies; 8+ messages in thread
From: jackysliu @ 2025-07-16 3:37 UTC (permalink / raw)
To: krzk
Cc: 1972843537, Austin.Zheng, Dillon.Varone, Security, Sung.Lee,
Wayne.Lin, airlied, alexander.deucher, alvin.lee2, amd-gfx,
aurabindo.pillai, christian.koenig, dri-devel, harry.wentland,
joshua.aberback, linux-kernel, linux, mario.limonciello, ryanseto,
simona, siqueira, sunpeng.li
On Tue, Jul 15 2025 12:44:40 +0200 Krzysztof Kozlowski wrote:
>You should disclose that you used some AI tool for that... and that
>other report(s) was really fake finding. People should know you
>generated it with AI, so they could make informed decision whether to
>even allocate time here.
Although this problem was detected with the help of ai and static methods,
I checked the trigger path by myself and verified this problem.
I'll describe the ways of detection if I find other issues in the future.
Anyway, thanks for your review.
Siyang Liu
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-07-16 7:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 3:39 [PATCH] drm/amd/display:fix a Null pointer dereference vulnerability jackysliu
2025-07-03 15:15 ` Harry Wentland
2025-07-04 3:11 ` jackysliu
2025-07-04 3:16 ` [PATCH v2] " jackysliu
2025-07-15 10:44 ` Krzysztof Kozlowski
2025-07-15 21:29 ` Mario Limonciello
2025-07-16 3:10 ` [PATCH] scsi:bfa: Double-free vulnerability fix jackysliu
2025-07-16 3:37 ` [PATCH v2] drm/amd/display:fix a Null pointer dereference vulnerability jackysliu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).