projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
66976a3
)
regulator: core: fix module refcount leak in set_supply()
author
Yang Yingliang
<yangyingliang@huawei.com>
Thu, 1 Dec 2022 12:27:05 +0000
(20:27 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:15 +0000
(13:14 +0100)
[ 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@huawei.com>
Link:
https://lore.kernel.org/r/20221201122706.4055992-2-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/regulator/core.c
patch
|
blob
|
history
diff --git
a/drivers/regulator/core.c
b/drivers/regulator/core.c
index 65900895a0b29afc3f3ac6679c7c2b1bc004faa7..ab93debb817c31418fb505d1062e86379d76253a 100644
(file)
--- a/
drivers/regulator/core.c
+++ b/
drivers/regulator/core.c
@@
-1577,6
+1577,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;
}