Skip to content

Commit 0737e01

Browse files
Yuuoniykuba-moo
authored andcommitted
net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list
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: 14fceff ("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>
1 parent 91ffb08 commit 0737e01

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/net/dsa/lantiq_gswip.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,8 +2070,10 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
20702070
for_each_available_child_of_node(gphy_fw_list_np, gphy_fw_np) {
20712071
err = gswip_gphy_fw_probe(priv, &priv->gphy_fw[i],
20722072
gphy_fw_np, i);
2073-
if (err)
2073+
if (err) {
2074+
of_node_put(gphy_fw_np);
20742075
goto remove_gphy;
2076+
}
20752077
i++;
20762078
}
20772079

0 commit comments

Comments
 (0)