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 stm32pwrregulatorprobe() warn: 'base' from ofiomap() not released on lines: 151,166.
In stm32pwrregulatorprobe(), base is not released when devmkzalloc() fails to allocate memory or devmregulatorregister() fails to register a new regulator device, which may cause a leak.
To fix this issue, replace ofiomap() with devmplatformioremapresource(). devmplatformioremap_resource() is a specialized function for platform devices. It allows 'base' to be automatically released whether the probe function succeeds or fails.
Besides, use ISERR(base) instead of !base as the return value of devmplatformioremapresource() can either be a pointer to the remapped memory or an ERR_PTR() encoded error code if the operation fails.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/54xxx/CVE-2023-54097.json"
}