diff options
author | Konstantin Meskhidze <konstantin.meskhidze@huawei.com> | 2023-08-17 14:59:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-13 10:42:47 +0300 |
commit | 500a6ff9c2a81348fe0f04e2deb758145e8ab94e (patch) | |
tree | 3fcdedbbdeb9ea0246d438d39655a5f4435b62e9 /drivers/nvdimm | |
parent | f6f300ecc196d243c02adeb9ee0c62c677c24bfb (diff) | |
download | linux-500a6ff9c2a81348fe0f04e2deb758145e8ab94e.tar.xz |
nvdimm: Fix memleak of pmu attr_groups in unregister_nvdimm_pmu()
[ Upstream commit 85ae42c72142346645e63c33835da947dfa008b3 ]
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: 0fab1ba6ad6b ("drivers/nvdimm: Add perf interface to expose nvdimm performance stats")
Co-developed-by: Ivanov Mikhail <ivanov.mikhail1@huawei-partners.com>
Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Link: https://lore.kernel.org/r/20230817115945.771826-1-konstantin.meskhidze@huawei.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r-- | drivers/nvdimm/nd_perf.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvdimm/nd_perf.c b/drivers/nvdimm/nd_perf.c index 433bbb68ae64..14881c4e03e6 100644 --- a/drivers/nvdimm/nd_perf.c +++ b/drivers/nvdimm/nd_perf.c @@ -324,6 +324,7 @@ void unregister_nvdimm_pmu(struct nvdimm_pmu *nd_pmu) { perf_pmu_unregister(&nd_pmu->pmu); nvdimm_pmu_free_hotplug_memory(nd_pmu); + kfree(nd_pmu->pmu.attr_groups); kfree(nd_pmu); } EXPORT_SYMBOL_GPL(unregister_nvdimm_pmu); |