Patch "regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()" has been added to the 4.14-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 unbalanced of node refcount in regulator_dev_lookup()

to the 4.14-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-unbalanced-of-node-refcount-in-re.patch
and it can be found in the queue-4.14 subdirectory.

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



commit 322e2e7e8974be0eeb1d3ee5b8862e0efa6d49e9
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Tue Nov 15 17:15:08 2022 +0800

    regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()
    
    [ Upstream commit f2b41b748c19962b82709d9f23c6b2b0ce9d2f91 ]
    
    I got the the following report:
    
      OF: ERROR: memory leak, expected refcount 1 instead of 2,
      of_node_get()/of_node_put() unbalanced - destroy cset entry:
      attach overlay node /i2c/pmic@62/regulators/exten
    
    In of_get_regulator(), the node is returned from of_parse_phandle()
    with refcount incremented, after using it, of_node_put() need be called.
    
    Fixes: 69511a452e6d ("regulator: map consumer regulator based on device tree")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221115091508.900752-1-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 ce5162ef9216..d6cd8e6e69cf 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1478,6 +1478,7 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
 		node = of_get_regulator(dev, supply);
 		if (node) {
 			r = of_find_regulator_by_node(node);
+			of_node_put(node);
 			if (r)
 				return r;
 



[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