Skip to content
Snippets Groups Projects
Commit 0c62d310 authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Yongqiang Liu
Browse files

ACPI: APD: Check for NULL pointer after calling devm_ioremap()

mainline inclusion
from mainline-v5.17-rc1
commit 2cea3ec5b0099d0e9dd6752aa86e08bce38d6b32
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5LBE7


CVE: NA

--------------------------------

Because devres_alloc() may fail, devm_ioremap() may return NULL.

Then, 'clk_data->base' will be assigned to clkdev->data->base in
platform_device_register_data().

The PTR_ERR_OR_ZERO() check on clk_data does not cover 'base', so
it is better to add an explicit check against NULL after updating
it.

Fixes: 3f4ba94e ("ACPI: APD: Add AMD misc clock handler support")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
[ rjw: Changelog rewrite ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 230917b0
No related branches found
No related tags found
No related merge requests found
......@@ -105,6 +105,8 @@ static int st_misc_setup(struct apd_private_data *pdata)
resource_size(rentry->res));
break;
}
if (!clk_data->base)
return -ENOMEM;
acpi_dev_free_resource_list(&resource_list);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment