diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-10-31 15:43:37 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 11:30:29 +0100 |
commit | 655a37f1616a9caab08c3dd7929e56673a3871d8 (patch) | |
tree | 54a302fdd81318319f05575d83e00051976777a6 /drivers/hsi | |
parent | 4556a01ff2e55e7332552c9183f21e56f2bd2d1d (diff) | |
download | linux-stable-655a37f1616a9caab08c3dd7929e56673a3871d8.tar.gz linux-stable-655a37f1616a9caab08c3dd7929e56673a3871d8.tar.bz2 linux-stable-655a37f1616a9caab08c3dd7929e56673a3871d8.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>
Diffstat (limited to 'drivers/hsi')
-rw-r--r-- | drivers/hsi/controllers/omap_ssi_core.c | 4 |
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 b91a6b6c0d7a..2f1a576fa8b7 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -538,8 +538,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); |