This is a note to let you know that I've just added the patch titled nvdimm: Fix memleak of pmu attr_groups in unregister_nvdimm_pmu() to the 6.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nvdimm-fix-memleak-of-pmu-attr_groups-in-unregister_.patch and it can be found in the queue-6.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit ab929d6de35c4a879cc77db4264d3123a3c2acf1 Author: Konstantin Meskhidze <konstantin.meskhidze@xxxxxxxxxx> Date: Thu Aug 17 19:59:45 2023 +0800 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@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@xxxxxxxxxx> Reviewed-by: Jeff Moyer <jmoyer@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230817115945.771826-1-konstantin.meskhidze@xxxxxxxxxx Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/nvdimm/nd_perf.c b/drivers/nvdimm/nd_perf.c index 433bbb68ae641..14881c4e03e6b 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);