Patch "nvdimm: Fix dereference after free in register_nvdimm_pmu()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nvdimm: Fix dereference after free in register_nvdimm_pmu()

to the 6.1-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-dereference-after-free-in-register_nvdimm.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cc83ca152257f078717a577614f57c8bf2986a73
Author: Konstantin Meskhidze <konstantin.meskhidze@xxxxxxxxxx>
Date:   Thu Aug 17 19:41:03 2023 +0800

    nvdimm: Fix dereference after free in register_nvdimm_pmu()
    
    [ Upstream commit 08ca6906a4b7e48f8e93b7c1f49a742a415be6d5 ]
    
    'nd_pmu->pmu.attr_groups' is dereferenced in function
    'nvdimm_pmu_free_hotplug_memory' call after it has been freed. Because in
    function 'nvdimm_pmu_free_hotplug_memory' memory pointed by the fields of
    'nd_pmu->pmu.attr_groups' is deallocated it is necessary to call 'kfree'
    after 'nvdimm_pmu_free_hotplug_memory'.
    
    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/20230817114103.754977-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 14881c4e03e6b..2b6dc80d8fb5b 100644
--- a/drivers/nvdimm/nd_perf.c
+++ b/drivers/nvdimm/nd_perf.c
@@ -308,8 +308,8 @@ int register_nvdimm_pmu(struct nvdimm_pmu *nd_pmu, struct platform_device *pdev)
 
 	rc = perf_pmu_register(&nd_pmu->pmu, nd_pmu->pmu.name, -1);
 	if (rc) {
-		kfree(nd_pmu->pmu.attr_groups);
 		nvdimm_pmu_free_hotplug_memory(nd_pmu);
+		kfree(nd_pmu->pmu.attr_groups);
 		return rc;
 	}
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux