CVE-2022-49436
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
26/02/2025
Last modified:
26/02/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
powerpc/papr_scm: Fix leaking nvdimm_events_map elements<br />
<br />
Right now &#39;char *&#39; elements allocated for individual &#39;stat_id&#39; in<br />
&#39;papr_scm_priv.nvdimm_events_map[]&#39; during papr_scm_pmu_check_events(), get<br />
leaked in papr_scm_remove() and papr_scm_pmu_register(),<br />
papr_scm_pmu_check_events() error paths.<br />
<br />
Also individual &#39;stat_id&#39; arent NULL terminated &#39;char *&#39; instead they are fixed<br />
8-byte sized identifiers. However papr_scm_pmu_register() assumes it to be a<br />
NULL terminated &#39;char *&#39; and at other places it assumes it to be a<br />
&#39;papr_scm_perf_stat.stat_id&#39; sized string which is 8-byes in size.<br />
<br />
Fix this by allocating the memory for papr_scm_priv.nvdimm_events_map to also<br />
include space for &#39;stat_id&#39; entries. This is possible since number of available<br />
events/stat_ids are known upfront. This saves some memory and one extra level of<br />
indirection from &#39;nvdimm_events_map&#39; to &#39;stat_id&#39;. Also rest of the code<br />
can continue to call &#39;kfree(papr_scm_priv.nvdimm_events_map)&#39; without needing to<br />
iterate over the array and free up individual elements.