Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI: j721e: fix OF node reference leaks
@ 2026-11-10  7:09 zhaofeng2
  2026-11-10  7:09 ` [PATCH 1/2] PCI: j721e: Fix OF node reference leak in j721e_pcie_ctrl_init() zhaofeng2
  2026-11-10  7:09 ` [PATCH 2/2] PCI: j721e: Fix OF node reference leak in j721e_enable_acspcie_refclk() zhaofeng2
  0 siblings, 2 replies; 5+ messages in thread
From: zhaofeng2 @ 2026-11-10  7:09 UTC (permalink / raw)
  To: Bjorn Helgaas, Vignesh Raghavendra
  Cc: Zhao Feng, Siddharth Vadapalli, linux-omap, linux-pci,
	linux-arm-kernel

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

j721e_pcie_ctrl_init() and j721e_enable_acspcie_refclk() resolve
syscon phandles with of_parse_phandle_with_fixed_args(), which takes
a reference on the resolved device node.  Neither of them drops it,
so the referenced device node is leaked at probe; and since
j721e_pcie_resume_noirq() re-invokes j721e_pcie_ctrl_init() on every
resume, the leaks repeat on each suspend/resume cycle.

Drop the references once the phandle argument has been consumed.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] PCI: j721e: Fix OF node reference leak in j721e_pcie_ctrl_init()
  2026-11-10  7:09 [PATCH 0/2] PCI: j721e: fix OF node reference leaks zhaofeng2
@ 2026-11-10  7:09 ` zhaofeng2
  2026-11-10  7:19   ` sashiko-bot
  2026-11-10  7:09 ` [PATCH 2/2] PCI: j721e: Fix OF node reference leak in j721e_enable_acspcie_refclk() zhaofeng2
  1 sibling, 1 reply; 5+ messages in thread
From: zhaofeng2 @ 2026-11-10  7:09 UTC (permalink / raw)
  To: Bjorn Helgaas, Vignesh Raghavendra
  Cc: Zhao Feng, Siddharth Vadapalli, linux-omap, linux-pci,
	linux-arm-kernel

From: Zhao Feng <zhaofeng2@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@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"



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] PCI: j721e: Fix OF node reference leak in j721e_enable_acspcie_refclk()
  2026-11-10  7:09 [PATCH 0/2] PCI: j721e: fix OF node reference leaks zhaofeng2
  2026-11-10  7:09 ` [PATCH 1/2] PCI: j721e: Fix OF node reference leak in j721e_pcie_ctrl_init() zhaofeng2
@ 2026-11-10  7:09 ` zhaofeng2
  2026-11-10  7:16   ` sashiko-bot
  1 sibling, 1 reply; 5+ messages in thread
From: zhaofeng2 @ 2026-11-10  7:09 UTC (permalink / raw)
  To: Bjorn Helgaas, Vignesh Raghavendra
  Cc: Zhao Feng, Siddharth Vadapalli, linux-omap, linux-pci,
	linux-arm-kernel

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

j721e_enable_acspcie_refclk() resolves the "ti,syscon-acspcie-proxy-ctrl"
phandle with of_parse_phandle_with_fixed_args(), which takes a
reference on the resolved device node, but the reference is never
dropped, so the device node is leaked.  This is called from
j721e_pcie_ctrl_init(), which j721e_pcie_resume_noirq() re-invokes
on every resume, so the leak repeats on every suspend/resume cycle
as well.

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

Fixes: 82c4be4168e2 ("PCI: j721e: Enable ACSPCIE Refclk if "ti,syscon-acspcie-proxy-ctrl" exists")
Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
---
 drivers/pci/controller/cadence/pci-j721e.c | 1 +
 1 file changed, 1 insertion(+)

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
@@ -247,6 +247,7 @@
 
 	/* Clear PAD IO disable bits to enable refclk output */
 	val = ~(args.args[0]);
+	of_node_put(args.np);
 	ret = regmap_update_bits(syscon, 0, mask, val);
 	if (ret) {
 		dev_err(dev, "failed to enable ACSPCIE refclk: %d\n", ret);



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] PCI: j721e: Fix OF node reference leak in j721e_enable_acspcie_refclk()
  2026-11-10  7:09 ` [PATCH 2/2] PCI: j721e: Fix OF node reference leak in j721e_enable_acspcie_refclk() zhaofeng2
@ 2026-11-10  7:16   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-10  7:16 UTC (permalink / raw)
  To: zhaofeng2; +Cc: linux-pci

> From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
> 
> j721e_enable_acspcie_refclk() resolves the "ti,syscon-acspcie-proxy-ctrl"
> phandle with of_parse_phandle_with_fixed_args(), which takes a
> reference on the resolved device node, but the reference is never
> dropped, so the device node is leaked.  This is called from
> j721e_pcie_ctrl_init(), which j721e_pcie_resume_noirq() re-invokes
> on every resume, so the leak repeats on every suspend/resume cycle
> as well.
> 
> Drop the reference with of_node_put() once the mask argument has been
> consumed.
> 
> Fixes: 82c4be4168e2 ("PCI: j721e: Enable ACSPCIE Refclk if "ti,syscon-acspcie-proxy-ctrl" exists")
> Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110070944.996-1-zhaofeng2@cmss.chinamobile.com?part=2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] PCI: j721e: Fix OF node reference leak in j721e_pcie_ctrl_init()
  2026-11-10  7:09 ` [PATCH 1/2] PCI: j721e: Fix OF node reference leak in j721e_pcie_ctrl_init() zhaofeng2
@ 2026-11-10  7:19   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-10  7:19 UTC (permalink / raw)
  To: zhaofeng2; +Cc: linux-pci

> From: Zhao Feng <zhaofeng2@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@cmss.chinamobile.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110070944.996-1-zhaofeng2@cmss.chinamobile.com?part=1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-10  7:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10  7:09 [PATCH 0/2] PCI: j721e: fix OF node reference leaks zhaofeng2
2026-11-10  7:09 ` [PATCH 1/2] PCI: j721e: Fix OF node reference leak in j721e_pcie_ctrl_init() zhaofeng2
2026-11-10  7:19   ` sashiko-bot
2026-11-10  7:09 ` [PATCH 2/2] PCI: j721e: Fix OF node reference leak in j721e_enable_acspcie_refclk() zhaofeng2
2026-11-10  7:16   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox