From: Wentao Liang <vulab@iscas.ac.cn>
To: Liviu.Dudau@arm.com
Cc: bhelgaas@google.com, kwilczynski@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
lpieralisi@kernel.org, mani@kernel.org, robh@kernel.org,
tinamdar@apm.com, toan@os.amperecomputing.com,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] PCI: xgene: Fix device node reference leak in xgene_pcie_probe()
Date: Thu, 17 Sep 2026 13:22:35 +0000 [thread overview]
Message-ID: <20260917132235.2153154-1-vulab@iscas.ac.cn> (raw)
xgene_pcie_probe() takes a reference to the port's device node with
of_node_get(), but returns directly from the error paths of
xgene_pcie_map_reg(), xgene_pcie_init_port(), xgene_pcie_setup() and
pci_host_probe(), leaking that reference on each of them.
Add an err_put_node label that drops the reference before returning.
Fixes: 5f6b6ccdbe1c ("PCI: xgene: Add APM X-Gene PCIe driver")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/pci/controller/pci-xgene.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index b95afa35201d..6b00ec60ede6 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -633,20 +633,28 @@ static int xgene_pcie_probe(struct platform_device *pdev)
ret = xgene_pcie_map_reg(port, pdev);
if (ret)
- return ret;
+ goto err_put_node;
ret = xgene_pcie_init_port(port);
if (ret)
- return ret;
+ goto err_put_node;
ret = xgene_pcie_setup(port);
if (ret)
- return ret;
+ goto err_put_node;
bridge->sysdata = port;
bridge->ops = &xgene_pcie_ops;
- return pci_host_probe(bridge);
+ ret = pci_host_probe(bridge);
+ if (ret)
+ goto err_put_node;
+
+ return 0;
+
+err_put_node:
+ of_node_put(port->node);
+ return ret;
}
static const struct of_device_id xgene_pcie_match_table[] = {
--
2.34.1
next reply other threads:[~2026-09-17 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 13:22 Wentao Liang [this message]
2026-09-17 13:29 ` [PATCH] PCI: xgene: Fix device node reference leak in xgene_pcie_probe() sashiko-bot
2026-09-18 11:50 ` kernel test robot
2026-09-18 12:37 ` kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2026-08-14 13:41 Ruoyu Wang
2026-08-14 13:51 ` sashiko-bot
2026-09-10 12:23 ` Manivannan Sadhasivam
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=20260917132235.2153154-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=Liviu.Dudau@arm.com \
--cc=bhelgaas@google.com \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tinamdar@apm.com \
--cc=toan@os.amperecomputing.com \
/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