Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

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>

authored by

Yang Yingliang and committed by
Mark Brown
da46ee19 0591b14c

+1
+1
drivers/regulator/core.c
··· 1646 1646 1647 1647 rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY"); 1648 1648 if (rdev->supply == NULL) { 1649 + module_put(supply_rdev->owner); 1649 1650 err = -ENOMEM; 1650 1651 return err; 1651 1652 }