Patch "ARM: mxs: fix memory leak in mxs_machine_init()" has been added to the 4.9-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

    ARM: mxs: fix memory leak in mxs_machine_init()

to the 4.9-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:
     arm-mxs-fix-memory-leak-in-mxs_machine_init.patch
and it can be found in the queue-4.9 subdirectory.

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



commit 994423809df319050bac5414bc32dccc4100fa2a
Author: Zheng Yongjun <zhengyongjun3@xxxxxxxxxx>
Date:   Thu Nov 17 06:20:11 2022 +0000

    ARM: mxs: fix memory leak in mxs_machine_init()
    
    [ Upstream commit f31e3c204d1844b8680a442a48868af5ac3d5481 ]
    
    If of_property_read_string() failed, 'soc_dev_attr' should be
    freed before return. Otherwise there is a memory leak.
    
    Fixes: 2046338dcbc6 ("ARM: mxs: Use soc bus infrastructure")
    Signed-off-by: Zheng Yongjun <zhengyongjun3@xxxxxxxxxx>
    Reviewed-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
    Signed-off-by: Shawn Guo <shawnguo@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index e4f21086b42b..57cb97ff82bc 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -393,8 +393,10 @@ static void __init mxs_machine_init(void)
 
 	root = of_find_node_by_path("/");
 	ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
-	if (ret)
+	if (ret) {
+		kfree(soc_dev_attr);
 		return;
+	}
 
 	soc_dev_attr->family = "Freescale MXS Family";
 	soc_dev_attr->soc_id = mxs_get_soc_id();



[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