Patch "regulator: core: fix module refcount leak in set_supply()" 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

    regulator: core: fix module refcount leak in set_supply()

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:
     regulator-core-fix-module-refcount-leak-in-set_suppl.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 6a2559fabeb97d9b0bf458eebf2cfce829a9af87
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Thu Dec 1 20:27:05 2022 +0800

    regulator: core: fix module refcount leak in set_supply()
    
    [ Upstream commit da46ee19cbd8344d6860816b4827a7ce95764867 ]
    
    If create_regulator() fails in set_supply(), the module refcount
    needs be put to keep refcount balanced.
    
    Fixes: e2c09ae7a74d ("regulator: core: Increase refcount for regulator supply's module")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221201122706.4055992-2-yangyingliang@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e1f934fec562..cbc3397258f6 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1157,6 +1157,7 @@ static int set_supply(struct regulator_dev *rdev,
 
 	rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
 	if (rdev->supply == NULL) {
+		module_put(supply_rdev->owner);
 		err = -ENOMEM;
 		return err;
 	}



[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