summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-10-31 15:43:37 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-07 12:07:27 +0100
commit107eb675d3c3548b65a618afed7bb59d56634551 (patch)
tree13905edbf897c10dd9bd2e27b50e0770e024d2b5
parent8a502dfab2b08f45824e67274b93dce261fc8b72 (diff)
downloadlinux-stable-107eb675d3c3548b65a618afed7bb59d56634551.tar.gz
linux-stable-107eb675d3c3548b65a618afed7bb59d56634551.tar.bz2
linux-stable-107eb675d3c3548b65a618afed7bb59d56634551.zip
HSI: omap_ssi_core: fix possible memory leak in ssi_probe()
[ Upstream commit 1aff514e1d2bd47854dbbdf867970b9d463d4c57 ] If ssi_add_controller() returns error, it should call hsi_put_controller() to give up the reference that was set in hsi_alloc_controller(), so that it can call hsi_controller_release() to free controller and ports that allocated in hsi_alloc_controller(). Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/hsi/controllers/omap_ssi_core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index db9328c05492..9e82f9f8f0a3 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -540,8 +540,10 @@ static int ssi_probe(struct platform_device *pd)
platform_set_drvdata(pd, ssi);
err = ssi_add_controller(ssi, pd);
- if (err < 0)
+ if (err < 0) {
+ hsi_put_controller(ssi);
goto out1;
+ }
pm_runtime_enable(&pd->dev);