CVE-2023-54097
regulator: stm32-pwr: fix of_iomap leak
In the Linux kernel, the following vulnerability has been resolved:
regulator: stm32-pwr: fix of_iomap leak
Smatch reports:
drivers/regulator/stm32-pwr.c:166 stm32_pwr_regulator_probe() warn:
'base' from of_iomap() not released on lines: 151,166.
In stm32_pwr_regulator_probe(), base is not released
when devm_kzalloc() fails to allocate memory or
devm_regulator_register() fails to register a new regulator device,
which may cause a leak.
To fix this issue, replace of_iomap() with
devm_platform_ioremap_resource(). devm_platform_ioremap_resource()
is a specialized function for platform devices.
It allows 'base' to be automatically released whether the probe
function succeeds or fails.
Besides, use IS_ERR(base) instead of !base
as the return value of devm_platform_ioremap_resource()
can either be a pointer to the remapped memory or
an ERR_PTR() encoded error code if the operation fails.
Affected products
Linux · LinuxWant to know if your infrastructure is exposed to this?
Talk to TrueHacking →References
https://git.kernel.org/stable/c/0ad07e02be0d3f0d554653382ffe53ae4879378dhttps://git.kernel.org/stable/c/824683dbec234a01bd49a0589ee3323594a6f4cfhttps://git.kernel.org/stable/c/ad6481f49fb2c703efa3a929643934f24b666d6ahttps://git.kernel.org/stable/c/c091bb49b3233307c7af73dae888f0799752af3dhttps://git.kernel.org/stable/c/c4a413e56d16a2ae84e6d8992f215c4dcc7fac20https://git.kernel.org/stable/c/dfce9bb3517a78507cf96f9b83948d0b81338afahttps://git.kernel.org/stable/c/f25994f7a9ad53eb756bc4869497c3ebe281ad5e