[PATCH] net: ethernet: ti: netcp_core: fix device_node refcount leak in netcp_probe()

Manush Prajwal <[email protected]>
Newsgroups gmane.linux.network
Message-ID <[email protected]>
When netcp_create_interface() fails for a given child node,
netcp_probe() jumps to probe_quit_interface, which releases the
"interfaces" parent node but never the "child" node that the
for_each_available_child_of_node() loop was iterating on. Normal loop
progression relies on the iterator itself to drop each nodes
reference; this abrupt goto skips that. Add the missing of_node_put()
for child at the error label.

Signed-off-by: Manush Prajwal <[email protected]>
---
 drivers/net/ethernet/ti/netcp_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index eb8fc2ed05..a888aa35fa 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2271,6 +2271,7 @@ static int netcp_probe(struct platform_device *pdev)
 	return 0;
 
 probe_quit_interface:
+	of_node_put(child);
 	list_for_each_entry_safe(netcp_intf, netcp_tmp,
 				 &netcp_device->interface_head,
 				 interface_list) {
-- 
2.46.2.windows.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.