net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list
authorMiaoqian Lin <linmq006@gmail.com>
Sun, 5 Jun 2022 07:23:34 +0000 (11:23 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:17 +0000 (18:36 +0200)
commit54d6802c4d83fa8de7696cfec06f475d5fd92d27
tree0020e071d3d314741e95ddbf0e63a287a722ca01
parent3f4d5e727aeaa610688d46c9f101f78b7f712583
net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list

[ Upstream commit 0737e018a05e2aa352828c52bdeed3b02cff2930 ]

Every iteration of for_each_available_child_of_node() decrements
the reference count of the previous node.
when breaking early from a for_each_available_child_of_node() loop,
we need to explicitly call of_node_put() on the gphy_fw_np.
Add missing of_node_put() to avoid refcount leak.

Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220605072335.11257-1-linmq006@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/lantiq_gswip.c