[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250829063431.1968903-1-linmq006@gmail.com>
Date: Fri, 29 Aug 2025 14:34:29 +0800
From: Miaoqian Lin <linmq006@...il.com>
To: Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Miaoqian Lin <linmq006@...il.com>,
Jeff Garzik <jeff@...zik.org>,
Olof Johansson <olof@...om.net>,
linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] powerpc/pasemi: Fix PCI device reference leak on error path
Fix iob_pdev reference leak in pasemi_dma_init() when dma_pdev
allocation fails. Ensure pci_dev_put(iob_pdev) is called on
both success and error paths.
Fixes: 8ee9d8577935 ("pasemi: DMA engine management library")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
arch/powerpc/platforms/pasemi/dma_lib.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index 1be1f18f6f09..0ba05c39c276 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -530,7 +530,7 @@ int pasemi_dma_init(void)
BUG();
pr_warn("Can't find DMA controller\n");
err = -ENODEV;
- goto out;
+ goto out_put_iob;
}
dma_regs = map_onedev(dma_pdev, 0);
base_hw_irq = virq_to_hw(dma_pdev->irq);
@@ -617,5 +617,9 @@ int pasemi_dma_init(void)
out:
spin_unlock(&init_lock);
return err;
+
+out_put_iob:
+ pci_dev_put(iob_pdev);
+ goto out;
}
EXPORT_SYMBOL(pasemi_dma_init);
--
2.35.1
Powered by blists - more mailing lists