All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains
@ 2022-06-05  5:51 Miaoqian Lin
  2022-06-06 21:32 ` Rob Herring
  2022-06-08 20:27 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-06-05  5:51 UTC (permalink / raw)
  To: Daire McNamara, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
	linux-kernel
  Cc: linmq006

of_get_next_child() returns a node pointer with refcount incremented,
we should use of_node_put() on it when not need anymore.
This function only call of_node_put() in normal path,
missing it in some error paths.
Add missing of_node_put() to avoid refcount leak.

Fixes: 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controller driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/pci/controller/pcie-microchip-host.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
index dd5dba419047..7263d175b5ad 100644
--- a/drivers/pci/controller/pcie-microchip-host.c
+++ b/drivers/pci/controller/pcie-microchip-host.c
@@ -904,6 +904,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *port)
 						   &event_domain_ops, port);
 	if (!port->event_domain) {
 		dev_err(dev, "failed to get event domain\n");
+		of_node_put(pcie_intc_node);
 		return -ENOMEM;
 	}
 
@@ -913,6 +914,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *port)
 						  &intx_domain_ops, port);
 	if (!port->intx_domain) {
 		dev_err(dev, "failed to get an INTx IRQ domain\n");
+		of_node_put(pcie_intc_node);
 		return -ENOMEM;
 	}
 
-- 
2.25.1


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

end of thread, other threads:[~2022-06-08 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05  5:51 [PATCH] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains Miaoqian Lin
2022-06-06 21:32 ` Rob Herring
2022-06-08 20:27 ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.