powercap: intel_rapl: Fix memory leak in rapl_add_package_cpuslocked()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
powercap: intel_rapl: Fix memory leak in rapl_add_package_cpuslocked()
When topology_physical_package_id()/topology_logical_die_id() returns a negative value, rapl_add_package_cpuslocked() returns ERR_PTR(-EINVAL) directly without freeing the rapl_package structure that was just allocated by kzalloc_obj(), leaking memory on every failed package addition.
Use the existing err_free_package label so that the allocation is released on the error path.
From the CVE record · Linux
The Linux kernel leaks memory when intel_rapl fails to add a package because a topology function returns a negative ID. Each failed addition leaks the newly allocated package structure. The input does not describe an attacker path, authentication requirement, or user interaction.
Engineers running the Linux kernel should check whether their kernel includes the affected intel_rapl code; affected versions are not specified.