Skip to content

Commit 5d41f9b

Browse files
dinghaoliukuba-moo
authored andcommitted
net: ethernet: Fix memleak in ethoc_probe
When mdiobus_register() fails, priv->mdio allocated by mdiobus_alloc() has not been freed, which leads to memleak. Fixes: e7f4dc3 ("mdio: Move allocation of interrupts into core") Signed-off-by: Dinghao Liu <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 427c940 commit 5d41f9b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/ethoc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ static int ethoc_probe(struct platform_device *pdev)
12111211
ret = mdiobus_register(priv->mdio);
12121212
if (ret) {
12131213
dev_err(&netdev->dev, "failed to register MDIO bus\n");
1214-
goto free2;
1214+
goto free3;
12151215
}
12161216

12171217
ret = ethoc_mdio_probe(netdev);
@@ -1243,6 +1243,7 @@ static int ethoc_probe(struct platform_device *pdev)
12431243
netif_napi_del(&priv->napi);
12441244
error:
12451245
mdiobus_unregister(priv->mdio);
1246+
free3:
12461247
mdiobus_free(priv->mdio);
12471248
free2:
12481249
clk_disable_unprepare(priv->clk);

0 commit comments

Comments
 (0)