提交 1788e4cb 编写于 作者: M Miaoqian Lin 提交者: Zheng Zengkai

net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register

stable inclusion
from stable-v5.10.122
commit 42658e47f1abbbe592007d3ba303de466114d0bb
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5W6OE

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=42658e47f1abbbe592007d3ba303de466114d0bb

--------------------------------

[ Upstream commit 02ded5a1 ]

of_get_child_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.

mv88e6xxx_mdio_register() pass the device node to of_mdiobus_register().
We don't need the device node after it.

Add missing of_node_put() to avoid refcount leak.

Fixes: a3c53be5 ("net: dsa: mv88e6xxx: Support multiple MDIO busses")
Signed-off-by: NMiaoqian Lin <linmq006@gmail.com>
Reviewed-by: NMarek Behún <kabel@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 ca96feb9
...@@ -3148,6 +3148,7 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, ...@@ -3148,6 +3148,7 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
*/ */
child = of_get_child_by_name(np, "mdio"); child = of_get_child_by_name(np, "mdio");
err = mv88e6xxx_mdio_register(chip, child, false); err = mv88e6xxx_mdio_register(chip, child, false);
of_node_put(child);
if (err) if (err)
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册