* [PATCH] drm/amd/display: Fix NULL deref in dcn401_update_clocks_update_dtb_dto
@ 2026-10-19 7:29 Roman Demidov
2026-10-31 1:44 ` Alex Hung
0 siblings, 1 reply; 2+ messages in thread
From: Roman Demidov @ 2026-10-19 7:29 UTC (permalink / raw)
To: Harry Wentland
Cc: Roman Demidov, Leo Li, Rodrigo Siqueira, Alex Deucher,
Christian König, David Airlie, Simona Vetter, Dillon Varone,
Gaghik Khachatrian, James Lin, Austin Zheng,
Bhuvanachandra Pinninti, Kees Cook, Wenjing Liu, Alvin Lee,
Fangzhi Zuo, amd-gfx, dri-devel, linux-kernel, lvc-project
[Why]
resource_get_otg_master_for_stream() can return NULL if no OTG master pipe
is found for a given stream. The current code dereferences this pointer
without a NULL check. This may lead to a possible NULL pointer
dereference.
[How]
Add an explicit NULL check and skip the stream if the OTG master is not
found. This is similar to dcn60_update_clocks_update_dtb_dto().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: b6d508533fa1 ("drm/amd/display: fix a crash when clock source is reference for non otg master pipe")
Signed-off-by: Roman Demidov <roman.demidov.nn@gmail.com>
---
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c
index 6ee3da89d058..135eeef68ac4 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c
@@ -538,6 +538,9 @@ static void dcn401_update_clocks_update_dtb_dto(struct clk_mgr_internal *clk_mgr
otg_master = resource_get_otg_master_for_stream(
&context->res_ctx, context->streams[i]);
ASSERT(otg_master);
+ if (!otg_master)
+ continue;
+
ASSERT(otg_master->clock_source);
ASSERT(otg_master->clock_source->funcs->program_pix_clk);
ASSERT(otg_master->stream_res.pix_clk_params.controller_id >= CONTROLLER_ID_D0);
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amd/display: Fix NULL deref in dcn401_update_clocks_update_dtb_dto
2026-10-19 7:29 [PATCH] drm/amd/display: Fix NULL deref in dcn401_update_clocks_update_dtb_dto Roman Demidov
@ 2026-10-31 1:44 ` Alex Hung
0 siblings, 0 replies; 2+ messages in thread
From: Alex Hung @ 2026-10-31 1:44 UTC (permalink / raw)
To: Roman Demidov, Harry Wentland
Cc: Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
David Airlie, Simona Vetter, Dillon Varone, Gaghik Khachatrian,
James Lin, Austin Zheng, Bhuvanachandra Pinninti, Kees Cook,
Wenjing Liu, Alvin Lee, Fangzhi Zuo, amd-gfx, dri-devel,
linux-kernel, lvc-project
Reviewed-by: Alex Hung <alex.hung@amd.com>
On 10/19/26 01:29, Roman Demidov wrote:
> [Why]
> resource_get_otg_master_for_stream() can return NULL if no OTG master pipe
> is found for a given stream. The current code dereferences this pointer
> without a NULL check. This may lead to a possible NULL pointer
> dereference.
>
> [How]
> Add an explicit NULL check and skip the stream if the OTG master is not
> found. This is similar to dcn60_update_clocks_update_dtb_dto().
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: b6d508533fa1 ("drm/amd/display: fix a crash when clock source is reference for non otg master pipe")
> Signed-off-by: Roman Demidov <roman.demidov.nn@gmail.com>
> ---
> drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c
> index 6ee3da89d058..135eeef68ac4 100644
> --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c
> +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c
> @@ -538,6 +538,9 @@ static void dcn401_update_clocks_update_dtb_dto(struct clk_mgr_internal *clk_mgr
> otg_master = resource_get_otg_master_for_stream(
> &context->res_ctx, context->streams[i]);
> ASSERT(otg_master);
> + if (!otg_master)
> + continue;
> +
> ASSERT(otg_master->clock_source);
> ASSERT(otg_master->clock_source->funcs->program_pix_clk);
> ASSERT(otg_master->stream_res.pix_clk_params.controller_id >= CONTROLLER_ID_D0);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-31 1:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-19 7:29 [PATCH] drm/amd/display: Fix NULL deref in dcn401_update_clocks_update_dtb_dto Roman Demidov
2026-10-31 1:44 ` Alex Hung
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®