]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
regulator: core: Release coupled_rdevs on regulator_init_coupling() error
authorDmitry Osipenko <digetx@gmail.com>
Fri, 25 Oct 2019 00:22:39 +0000 (03:22 +0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 05:04:26 +0000 (00:04 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860490
[ Upstream commit 26c2c997aa1a6c5522f6619910ba025e53e69763 ]

This patch fixes memory leak which should happen if regulator's coupling
fails to initialize.

Fixes: d8ca7d184b33 ("regulator: core: Introduce API for regulators coupling customization")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20191025002240.25288-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/regulator/core.c

index 1b35b83116508d0cd0c1aa264024409461aa27ef..b06535e57a8be6e6897b841a098e837a5fa7dcbb 100644 (file)
@@ -5179,6 +5179,7 @@ unset_supplies:
        regulator_remove_coupling(rdev);
        mutex_unlock(&regulator_list_mutex);
 wash:
+       kfree(rdev->coupling_desc.coupled_rdevs);
        kfree(rdev->constraints);
        mutex_lock(&regulator_list_mutex);
        regulator_ena_gpio_free(rdev);