From: Miaoqian Lin Date: Thu, 26 May 2022 14:52:08 +0000 (+0400) Subject: net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register X-Git-Tag: baikal/aarch64/sdk6.1~3836^2~41 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=f9ecb3fd134743f249d9155c7a9eb61f444cf295;p=kernel.git net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register 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: b34277b7205d ("net: dsa: mv88e6xxx: Support multiple MDIO busses") Signed-off-by: Miaoqian Lin Reviewed-by: Marek BehĂșn Signed-off-by: David S. Miller --- diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 5d2c57a7c708e..0b49d243e00ba 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3960,6 +3960,7 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, */ child = of_get_child_by_name(np, "mdio"); err = mv88e6xxx_mdio_register(chip, child, false); + of_node_put(child); if (err) return err;