[PATCH] powerpc: Fix refcount leak in fsl_setup_msi_irqs

Zheng Yongjun zhengyongjun3 at huawei.com
Thu May 26 11:09:35 AEST 2022


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: 895d603f945ba ("powerpc/fsl_msi: add support for the fsl, msi property in PCI nodes")
Signed-off-by: Zheng Yongjun <zhengyongjun3 at huawei.com>
---
 arch/powerpc/sysdev/fsl_msi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index b3475ae9f236..dcc6c8997b09 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -207,6 +207,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 			dev_err(&pdev->dev,
 				"node %pOF has an invalid fsl,msi phandle %u\n",
 				hose->dn, np->phandle);
+			of_node_put(np);
 			return -EINVAL;
 		}
 	}
-- 
2.17.1



More information about the Linuxppc-dev mailing list