WARM1d

[PATCH] PCI: xgene: Fix device node reference leak in xgene_pcie_probe()

From: Ruoyu Wang <hidden>
Date: 2026-08-14 13:41:40
Also in: linux-pci, lkml
Subsystem: pci driver for appliedmicro xgene, pci native host bridge and endpoint drivers, pci subsystem, the rest · Maintainers: Toan Le, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas, Linus Torvalds

xgene_pcie_probe() takes an extra reference to the platform device's OF
node and stores it in port->node. The driver never drops the reference,
so every probe attempt that reaches this point leaks it, including when
CSR mapping or a later initialization step fails.

The platform device already holds the node reference, and port->node is
only dereferenced synchronously by xgene_pcie_setup() before probe
returns. Store the borrowed pointer instead of taking another reference.

This issue was found by a static analysis checker and confirmed by
manual source review.

Fixes: 5f6b6ccdbe1c ("PCI: xgene: Add APM X-Gene PCIe driver")
Signed-off-by: Ruoyu Wang <redacted>
---
 drivers/pci/controller/pci-xgene.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index b95afa35201d0..cf9760f3a008e 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -627,7 +627,7 @@ static int xgene_pcie_probe(struct platform_device *pdev)
 
 	port = pci_host_bridge_priv(bridge);
 
-	port->node = of_node_get(dn);
+	port->node = dn;
 	port->dev = dev;
 	port->version = XGENE_PCIE_IP_VER_1;
 
-- 
2.51.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help