summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2025-11-17 17:12:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-01-23 11:21:33 +0100
commit2ed1a9de1f2d727ccae5bc9cc7c63ee3519c0c8b (patch)
tree1273dd7109356213290da1eb7f38be58ee130b49
parentf3c23b7e941349505c3d40de2cc0acd93d9ac057 (diff)
downloadlinux-2ed1a9de1f2d727ccae5bc9cc7c63ee3519c0c8b.tar.gz
linux-2ed1a9de1f2d727ccae5bc9cc7c63ee3519c0c8b.tar.bz2
linux-2ed1a9de1f2d727ccae5bc9cc7c63ee3519c0c8b.zip
dmaengine: bcm-sba-raid: fix device leak on probe
commit 7c3a46ebf15a9796b763a54272407fdbf945bed8 upstream. Make sure to drop the reference taken when looking up the mailbox device during probe on probe failures and on driver unbind. Fixes: 743e1c8ffe4e ("dmaengine: Add Broadcom SBA RAID driver") Cc: stable@vger.kernel.org # 4.13 Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20251117161258.10679-4-johan@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/dma/bcm-sba-raid.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c
index 7f0e76439ce5..ed037fa883f6 100644
--- a/drivers/dma/bcm-sba-raid.c
+++ b/drivers/dma/bcm-sba-raid.c
@@ -1699,7 +1699,7 @@ static int sba_probe(struct platform_device *pdev)
/* Prealloc channel resource */
ret = sba_prealloc_channel_resources(sba);
if (ret)
- goto fail_free_mchan;
+ goto fail_put_mbox;
/* Check availability of debugfs */
if (!debugfs_initialized())
@@ -1729,6 +1729,8 @@ skip_debugfs:
fail_free_resources:
debugfs_remove_recursive(sba->root);
sba_freeup_channel_resources(sba);
+fail_put_mbox:
+ put_device(sba->mbox_dev);
fail_free_mchan:
mbox_free_channel(sba->mchan);
return ret;
@@ -1744,6 +1746,8 @@ static void sba_remove(struct platform_device *pdev)
sba_freeup_channel_resources(sba);
+ put_device(sba->mbox_dev);
+
mbox_free_channel(sba->mchan);
}