Skip to contentSkip to conversation

PCI: brcmstb: Fix refcount leak in brcm_pcie_probe

PATCH In review Miaoqian Lin 3 participants 3 messages Jun 3, 2022 – Jun 8, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PCI: brcmstb: Fix refcount leak in brcm_pcie_probe

of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.

Fixes 40ca1bf580ef ("PCI: brcmstb: Add MSI support")

---
changes in v2:
- update Fixes tag.
v1 Link: https://lore.kernel.org/r/[email protected]

---
 drivers/pci/controller/pcie-brcmstb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +2 -0
index 375c0c40bbf8..e3b673441a11 100644
@@ -1597,8 +1597,10 @@ static int brcm_pcie_probe(struct platform_device *pdev)
 		ret = brcm_pcie_enable_msi(pcie);
 		if (ret) {
 			dev_err(pcie->dev, "probe of internal MSI failed");
+			of_node_put(msi_np);
 			goto fail;
 		}
+		of_node_put(msi_np);
 	}
 
 	bridge->ops = pcie->type == BCM7425 ? &brcm_pcie_ops32 : &brcm_pcie_ops;
Signature · 1 line
2.25.1
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Miaoqian Lin

of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.

Fixes 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
Quoted 7 lines

---
changes in v2:
- update Fixes tag.
v1 Link: https://lore.kernel.org/r/[email protected]

---
 drivers/pci/controller/pcie-brcmstb.c | 2 ++
 1 file changed, 2 insertions(+)
#2 lore raw
In reply to Miaoqian Lin
Quoted 6 lines · Miaoqian Lin

of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.

Fixes 40ca1bf580ef ("PCI: brcmstb: Add MSI support")

Applied with Rob's reviewed-by to pci/ctrl/brcmstb for v5.20, thanks!

Quoted 31 lines

---
changes in v2:
- update Fixes tag.
v1 Link: https://lore.kernel.org/r/[email protected]

---
 drivers/pci/controller/pcie-brcmstb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +2 -0
index 375c0c40bbf8..e3b673441a11 100644
@@ -1597,8 +1597,10 @@ static int brcm_pcie_probe(struct platform_device *pdev)
 		ret = brcm_pcie_enable_msi(pcie);
 		if (ret) {
 			dev_err(pcie->dev, "probe of internal MSI failed");
+			of_node_put(msi_np);
 			goto fail;
 		}
+		of_node_put(msi_np);
 	}
 
 	bridge->ops = pcie->type == BCM7425 ? &brcm_pcie_ops32 : &brcm_pcie_ops;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel