nvdimm: Fix memleak of pmu attr_groups in unregister_nvdimm_pmu()
authorKonstantin Meskhidze <konstantin.meskhidze@huawei.com>
Thu, 17 Aug 2023 11:59:45 +0000 (19:59 +0800)
committerDave Jiang <dave.jiang@intel.com>
Thu, 17 Aug 2023 16:34:02 +0000 (09:34 -0700)
commit85ae42c72142346645e63c33835da947dfa008b3
treece7b5dda2c2224ba161b05ba5c38703b8e5bb8b0
parentfeb72e9b20823419aaed57801018eeffc7be7e82
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: 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>
drivers/nvdimm/nd_perf.c