drm/amdgpu: Fix potential NULL pointer dereference in atomctrl_get_smc_sclk_range_table
BugLink: https://bugs.launchpad.net/bugs/2111953
[ Upstream commit 357445e28ff004d7f10967aa93ddb4bffa5c3688 ]
The function atomctrl_get_smc_sclk_range_table() does not check the return
value of smu_atom_get_data_table(). If smu_atom_get_data_table() fails to
retrieve SMU_Info table, it returns NULL which is later dereferenced.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
In practice this should never happen as this code only gets called
on polaris chips and the vbios data table will always be present on
those chips.
Fixes: a23eefa2f4 ("drm/amd/powerplay: enable dpm for baffin.")
Signed-off-by: Ivan Stepchenko <sid@itb.spb.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
CVE-2024-58052
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
This commit is contained in:
committed by
Mehmet Basaran
parent
90fb5c7d7f
commit
6f5ecf7718
@@ -1420,6 +1420,8 @@ int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctr
|
||||
GetIndexIntoMasterTable(DATA, SMU_Info),
|
||||
&size, &frev, &crev);
|
||||
|
||||
if (!psmu_info)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < psmu_info->ucSclkEntryNum; i++) {
|
||||
table->entry[i].ucVco_setting = psmu_info->asSclkFcwRangeEntry[i].ucVco_setting;
|
||||
|
||||
Reference in New Issue
Block a user