Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: dsa: microchip: lan937x: fix reference count leak in lan937x_mdio_register()

This node pointer is returned by of_find_compatible_node() with
refcount incremented in this function. of_node_put() on it before
exitting this function.

Fixes: c9cd961c0d43 ("net: dsa: microchip: lan937x: add interrupt support for port phy link")
Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20220908040226.871690-1-sunke32@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Sun Ke and committed by
Jakub Kicinski
2f8a786f 42666b2c

+3 -1
+3 -1
drivers/net/dsa/microchip/lan937x_main.c
··· 238 238 ds->slave_mii_bus = bus; 239 239 240 240 ret = lan937x_irq_phy_setup(dev); 241 - if (ret) 241 + if (ret) { 242 + of_node_put(mdio_np); 242 243 return ret; 244 + } 243 245 244 246 ret = devm_of_mdiobus_register(ds->dev, bus, mdio_np); 245 247 if (ret) {