* [PATCH v1] PCI: keystone: Fix OF node reference leak in init
@ 2026-06-30 20:29 Yuho Choi
2026-07-15 6:15 ` Manivannan Sadhasivam
0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-06-30 20:29 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Bjorn Helgaas
Cc: linux-pci, Rob Herring, Siddharth Vadapalli, Niklas Cassel,
Frank Li, Qianfeng Rong, Koichiro Den, linux-kernel, Yuho Choi
of_find_matching_node() returns a device node with its reference count
incremented. ks_pcie_init() only uses the returned node to decide whether
to register the ARM external abort fault handler, but never drops the
reference.
Store the lookup result in a temporary variable and release it with
of_node_put() once the existence check has been made.
Fixes: bc10d0ad540d ("PCI: keystone: Add support to build as a loadable module")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/pci/controller/dwc/pci-keystone.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index 278d2dba1db0..f1b27aed488d 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -1389,13 +1389,17 @@ static int ks_pcie_fault(unsigned long addr, unsigned int fsr,
static int __init ks_pcie_init(void)
{
+ struct device_node *np;
/*
* PCIe access errors that result into OCP errors are caught by ARM as
* "External aborts"
*/
- if (of_find_matching_node(NULL, ks_pcie_of_match))
+ np = of_find_matching_node(NULL, ks_pcie_of_match);
+ if (np) {
+ of_node_put(np);
hook_fault_code(17, ks_pcie_fault, SIGBUS, 0,
"Asynchronous external abort");
+ }
return platform_driver_register(&ks_pcie_driver);
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1] PCI: keystone: Fix OF node reference leak in init
2026-06-30 20:29 [PATCH v1] PCI: keystone: Fix OF node reference leak in init Yuho Choi
@ 2026-07-15 6:15 ` Manivannan Sadhasivam
0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2026-07-15 6:15 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas, Yuho Choi
Cc: linux-pci, Rob Herring, Siddharth Vadapalli, Niklas Cassel,
Frank Li, Qianfeng Rong, Koichiro Den, linux-kernel
On Tue, 30 Jun 2026 16:29:38 -0400, Yuho Choi wrote:
> of_find_matching_node() returns a device node with its reference count
> incremented. ks_pcie_init() only uses the returned node to decide whether
> to register the ARM external abort fault handler, but never drops the
> reference.
>
> Store the lookup result in a temporary variable and release it with
> of_node_put() once the existence check has been made.
>
> [...]
Applied, thanks!
[1/1] PCI: keystone: Fix OF node reference leak in init
commit: 3260336defeb292a91de29e4d1d93469e3cec663
Best regards,
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-15 6:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-30 20:29 [PATCH v1] PCI: keystone: Fix OF node reference leak in init Yuho Choi
2026-07-15 6:15 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox