Skip to content

Commit 85ae42c

Browse files
BoardzMasterdavejiang
authored andcommitted
nvdimm: Fix memleak of pmu attr_groups in unregister_nvdimm_pmu()
Memory pointed by 'nd_pmu->pmu.attr_groups' is allocated in function 'register_nvdimm_pmu' and is lost after 'kfree(nd_pmu)' call in function 'unregister_nvdimm_pmu'. Fixes: 0fab1ba ("drivers/nvdimm: Add perf interface to expose nvdimm performance stats") Co-developed-by: Ivanov Mikhail <[email protected]> Signed-off-by: Konstantin Meskhidze <[email protected]> Reviewed-by: Jeff Moyer <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent feb72e9 commit 85ae42c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/nvdimm/nd_perf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ void unregister_nvdimm_pmu(struct nvdimm_pmu *nd_pmu)
324324
{
325325
perf_pmu_unregister(&nd_pmu->pmu);
326326
nvdimm_pmu_free_hotplug_memory(nd_pmu);
327+
kfree(nd_pmu->pmu.attr_groups);
327328
kfree(nd_pmu);
328329
}
329330
EXPORT_SYMBOL_GPL(unregister_nvdimm_pmu);

0 commit comments

Comments
 (0)