aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSun Ke <[email protected]>2022-09-08 04:02:26 +0000
committerJakub Kicinski <[email protected]>2022-09-19 21:17:59 +0000
commit2f8a786f472445d66348859af8795aa6ffd9ff8c (patch)
treea908c8832c644963ca6acc051bf586b9afca8137
parentr8169: disable detection of chip version 36 (diff)
downloadkernel-2f8a786f472445d66348859af8795aa6ffd9ff8c.tar.gz
kernel-2f8a786f472445d66348859af8795aa6ffd9ff8c.zip
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 <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
-rw-r--r--drivers/net/dsa/microchip/lan937x_main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c
index 9b6760b1e572..3e83f8ca0f09 100644
--- a/drivers/net/dsa/microchip/lan937x_main.c
+++ b/drivers/net/dsa/microchip/lan937x_main.c
@@ -238,8 +238,10 @@ static int lan937x_mdio_register(struct ksz_device *dev)
ds->slave_mii_bus = bus;
ret = lan937x_irq_phy_setup(dev);
- if (ret)
+ if (ret) {
+ of_node_put(mdio_np);
return ret;
+ }
ret = devm_of_mdiobus_register(ds->dev, bus, mdio_np);
if (ret) {