diff options
author | Miaoqian Lin <linmq006@gmail.com> | 2022-06-05 10:23:34 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-06-08 06:45:14 +0300 |
commit | 0737e018a05e2aa352828c52bdeed3b02cff2930 (patch) | |
tree | 867375ab8f91722c4e406cead30a6458db6f1bde /drivers | |
parent | 91ffb0893291ff80cb3695f87e397533abc26823 (diff) | |
download | linux-0737e018a05e2aa352828c52bdeed3b02cff2930.tar.xz |
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: 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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/dsa/lantiq_gswip.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index 8af4def38a98..e531b93f3cb2 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -2070,8 +2070,10 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv, for_each_available_child_of_node(gphy_fw_list_np, gphy_fw_np) { err = gswip_gphy_fw_probe(priv, &priv->gphy_fw[i], gphy_fw_np, i); - if (err) + if (err) { + of_node_put(gphy_fw_np); goto remove_gphy; + } i++; } |