From: Bob Zhou <bob.zhou@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <Qingqing.Zhuo@amd.com>,
<alexander.deucher@amd.com>
Cc: Bob Zhou <bob.zhou@amd.com>, Jun.Ma2@amd.com
Subject: [PATCH] drm/amd/display: Fix null pointer for res_pool->hubbub
Date: Wed, 20 Sep 2023 14:45:23 +0800 [thread overview]
Message-ID: <20230920064523.6361-1-bob.zhou@amd.com> (raw)
Recently, the driver introduce DML2 for future ASIC support.
But, some ASIC's hubbub pointer isn't set after calling
dce120_create_resource_pool(). Before setting get_dchub_ref_freq(),
these hubbub pointer is null, it cause the below null pointer issue.
So add check whether res_pool->hubbub to fix it.
BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:dc_create_resource_pool+0xc1/0x2c0 [amdgpu]
Call Trace:
<TASK>
? show_regs.cold+0x1a/0x1f
? __die_body+0x20/0x70
? __die+0x2b/0x37
? page_fault_oops+0x136/0x2c0
? do_user_addr_fault+0x303/0x660
? exc_page_fault+0x77/0x170
? asm_exc_page_fault+0x27/0x30
? dc_create_resource_pool+0xc1/0x2c0 [amdgpu]
? dc_create_resource_pool+0x243/0x2c0 [amdgpu]
dc_create+0x23f/0x6b0 [amdgpu]
? dmi_matches+0xa3/0x200
amdgpu_dm_init+0x2bd/0x22a0 [amdgpu]
Fixes: 50003b5aa5f5 ("drm/amd/display: Introduce DML2")
Signed-off-by: Bob Zhou <bob.zhou@amd.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index a93db60fe4d9..9cc7a001f9a1 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -319,10 +319,12 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc,
res_pool->ref_clocks.xtalin_clock_inKhz;
res_pool->ref_clocks.dchub_ref_clock_inKhz =
res_pool->ref_clocks.xtalin_clock_inKhz;
- if ((res_pool->hubbub->funcs->get_dchub_ref_freq))
- res_pool->hubbub->funcs->get_dchub_ref_freq(res_pool->hubbub,
- res_pool->ref_clocks.dccg_ref_clock_inKhz,
- &res_pool->ref_clocks.dchub_ref_clock_inKhz);
+ if (res_pool->hubbub)
+ if (res_pool->hubbub->funcs->get_dchub_ref_freq)
+ res_pool->hubbub->funcs->get_dchub_ref_freq(
+ res_pool->hubbub,
+ res_pool->ref_clocks.dccg_ref_clock_inKhz,
+ &res_pool->ref_clocks.dchub_ref_clock_inKhz);
} else
ASSERT_CRITICAL(false);
}
--
2.34.1
reply other threads:[~2023-09-20 6:45 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=20230920064523.6361-1-bob.zhou@amd.com \
--to=bob.zhou@amd.com \
--cc=Jun.Ma2@amd.com \
--cc=Qingqing.Zhuo@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.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