Patch "clk: socfpga: Fix memory leak in socfpga_gate_init()" has been added to the 5.10-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

    clk: socfpga: Fix memory leak in socfpga_gate_init()

to the 5.10-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:
     clk-socfpga-fix-memory-leak-in-socfpga_gate_init.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 6acff0ece45d78ae29878563fe308d219aa6f2ba
Author: Xiu Jianfeng <xiujianfeng@xxxxxxxxxx>
Date:   Wed Nov 23 11:16:22 2022 +0800

    clk: socfpga: Fix memory leak in socfpga_gate_init()
    
    [ Upstream commit 0b8ba891ad4d1ef6bfa4c72efc83f9f9f855f68b ]
    
    Free @socfpga_clk and @ops on the error path to avoid memory leak issue.
    
    Fixes: a30a67be7b6e ("clk: socfpga: Don't have get_parent for single parent ops")
    Signed-off-by: Xiu Jianfeng <xiujianfeng@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221123031622.63171-1-xiujianfeng@xxxxxxxxxx
    Acked-by: Dinh Nguyen <dinguyen@xxxxxxxxxx>
    Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
index 1ec9678d8cd3..ee2a2d284113 100644
--- a/drivers/clk/socfpga/clk-gate.c
+++ b/drivers/clk/socfpga/clk-gate.c
@@ -188,8 +188,10 @@ void __init socfpga_gate_init(struct device_node *node)
 		return;
 
 	ops = kmemdup(&gateclk_ops, sizeof(gateclk_ops), GFP_KERNEL);
-	if (WARN_ON(!ops))
+	if (WARN_ON(!ops)) {
+		kfree(socfpga_clk);
 		return;
+	}
 
 	rc = of_property_read_u32_array(node, "clk-gate", clk_gate, 2);
 	if (rc)
@@ -243,6 +245,7 @@ void __init socfpga_gate_init(struct device_node *node)
 
 	err = clk_hw_register(NULL, hw_clk);
 	if (err) {
+		kfree(ops);
 		kfree(socfpga_clk);
 		return;
 	}



[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