[PATCH 1/2] PCI: j721e: Fix OF node reference leak in j721e_pcie_ctrl_init()

zhaofeng2 zhaofeng2 at cmss.chinamobile.com
Mon Nov 9 23:09:42 PST 2026


From: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>

j721e_pcie_ctrl_init() resolves the "ti,syscon-pcie-ctrl" phandle
with of_parse_phandle_with_fixed_args(), which takes a reference on
the resolved device node, but the reference is never dropped.  Since
j721e_pcie_resume_noirq() re-invokes j721e_pcie_ctrl_init() on every
resume, the device node is leaked not only at probe but again on
every suspend/resume cycle.

Drop the reference with of_node_put() once the offset argument has
been consumed.

Fixes: 7aa256234c4c ("PCI: j721e: Get offset within "syscon" from "ti,syscon-pcie-ctrl" phandle arg")
Signed-off-by: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>
---
 drivers/pci/controller/cadence/pci-j721e.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -274,8 +274,10 @@
 	/* Do not error out to maintain old DT compatibility */
 	ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-pcie-ctrl", 1,
 					       0, &args);
-	if (!ret)
+	if (!ret) {
 		offset = args.args[0];
+		of_node_put(args.np);
+	}
 
 	/*
 	 * The PCIe Controller's registers have different "reset-values"





More information about the linux-arm-kernel mailing list