]> git.hungrycats.org Git - linux/commit
drm/amd/display: Add NULL check for clk_mgr and clk_mgr->funcs in dcn30_init_hw
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Mon, 22 Jul 2024 10:51:19 +0000 (16:21 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Dec 2024 09:32:40 +0000 (10:32 +0100)
commit205e3b96cc9aa9211fd2c849a16245cf236b2d36
tree6142e9e5b908c4bcf688de33b074ac461b473ce7
parentf14fc623dd23fc0e1352bddc37d5b66a85dea8c0
drm/amd/display: Add NULL check for clk_mgr and clk_mgr->funcs in dcn30_init_hw

commit cba7fec864172dadd953daefdd26e01742b71a6a upstream.

This commit addresses a potential null pointer dereference issue in the
`dcn30_init_hw` function. The issue could occur when `dc->clk_mgr` or
`dc->clk_mgr->funcs` is null.

The fix adds a check to ensure `dc->clk_mgr` and `dc->clk_mgr->funcs` is
not null before accessing its functions. This prevents a potential null
pointer dereference.

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:789 dcn30_init_hw() error: we previously assumed 'dc->clk_mgr' could be null (see line 628)

Cc: Tom Chung <chiahsuan.chung@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[Xiangyu: BP to fix CVE: CVE-2024-49917, modified the source path]
Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c