[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251030151043.63402-1-linmq006@gmail.com>
Date: Thu, 30 Oct 2025 23:10:40 +0800
From: Miaoqian Lin <linmq006@...il.com>
To: Madhavan Srinivasan <maddy@...ux.ibm.com>,
	Michael Ellerman <mpe@...erman.id.au>,
	Nicholas Piggin <npiggin@...il.com>,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	Scott Wood <scottwood@...escale.com>,
	Kumar Gala <galak@...nel.crashing.org>,
	linuxppc-dev@...ts.ozlabs.org,
	linux-kernel@...r.kernel.org
Cc: linmq006@...il.com,
	stable@...r.kernel.org
Subject: [PATCH] powerpc/fsl_uli1575: fix device_node reference leak in uli_init()
The of_get_parent() function increments the reference count of the
returned parent node, and of_node_put() is required to
release the reference when it is no longer needed.
The uli_init() function has a device_node reference leak.
The issue occurs in two scenarios:
1. When the function finds a matching device, it breaks out of the loop,
   the reference held by 'node' is not released.
2. When the loop terminates normally (of_get_parent returns NULL),
   the final parent node reference is not released.
Fix this by adding of_node_put(node).
Fixes: 91a6f347921e ("powerpc/mpc85xx_ds: convert to unified PCI init")
Cc: stable@...r.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
 arch/powerpc/platforms/fsl_uli1575.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index b8d37a9932f1..36624c88d5f3 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -376,4 +376,5 @@ void __init uli_init(void)
 			break;
 		}
 	}
+	of_node_put(node);
 }
-- 
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists
 
