diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-12-01 15:27:05 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-31 15:32:21 +0300 |
commit | 89f19d11aad82780d1d065164e98a6c1cb04a817 (patch) | |
tree | 78d36ac66174821cd259494b54cc6c0f294584de | |
parent | 2d4b9c7e81f3a4df27749ebecb426b145e68be2a (diff) | |
download | linux-89f19d11aad82780d1d065164e98a6c1cb04a817.tar.xz |
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@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>
-rw-r--r-- | drivers/regulator/core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 78b6469e74d5..bf418bc10146 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1640,6 +1640,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; } |