From: Miaoqian Lin <linmq006@gmail.com>
To: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Miaoqian Lin <linmq006@gmail.com>, Jeff Garzik <jeff@garzik.org>,
Olof Johansson <olof@lixom.net>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] powerpc/pasemi: Fix PCI device reference leak on error path
Date: Fri, 29 Aug 2025 14:34:29 +0800 [thread overview]
Message-ID: <20250829063431.1968903-1-linmq006@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2025-08-29 6:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 6:34 Miaoqian Lin [this message]
2025-09-02 14:34 ` [PATCH] powerpc/pasemi: Fix PCI device reference leak on error path Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250829063431.1968903-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=christophe.leroy@csgroup.eu \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=olof@lixom.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).