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

to the 5.15-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-fix-memory-leak-in-devm_clk_notifier_register.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 2d217d9280192df0254550e9bdeec25516adbd6b
Author: Fei Shao <fshao@xxxxxxxxxxxx>
Date:   Mon Jun 19 11:22:53 2023 +0800

    clk: Fix memory leak in devm_clk_notifier_register()
    
    [ Upstream commit 7fb933e56f77a57ef7cfc59fc34cbbf1b1fa31ff ]
    
    devm_clk_notifier_register() allocates a devres resource for clk
    notifier but didn't register that to the device, so the notifier didn't
    get unregistered on device detach and the allocated resource was leaked.
    
    Fix the issue by registering the resource through devres_add().
    
    This issue was found with kmemleak on a Chromebook.
    
    Fixes: 6d30d50d037d ("clk: add devm variant of clk_notifier_register")
    Signed-off-by: Fei Shao <fshao@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230619112253.v2.1.I13f060c10549ef181603e921291bdea95f83033c@changeid
    Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0674dbc62eb55..5eba83745d8de 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4504,6 +4504,7 @@ int devm_clk_notifier_register(struct device *dev, struct clk *clk,
 	if (!ret) {
 		devres->clk = clk;
 		devres->nb = nb;
+		devres_add(dev, devres);
 	} else {
 		devres_free(devres);
 	}



[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