Skip to content

Commit

Permalink
net: mdio: octeon: Fix some double free issues
Browse files Browse the repository at this point in the history
[ Upstream commit e1d027dd97e1e750669cdc0d3b016a4f54e473eb ]

'bus->mii_bus' has been allocated with 'devm_mdiobus_alloc_size()' in the
probe function. So it must not be freed explicitly or there will be a
double free.

Remove the incorrect 'mdiobus_free' in the error handling path of the
probe function and in remove function.

Suggested-By: Andrew Lunn <[email protected]>
Fixes: 35d2aea ("phy: mdio-octeon: Use devm_mdiobus_alloc_size()")
Signed-off-by: Christophe JAILLET <[email protected]>
Reviewed-by: Russell King <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
tititiou36 authored and gregkh committed Jun 3, 2021
1 parent f97bec5 commit e1c38c2
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/net/phy/mdio-octeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ static int octeon_mdiobus_probe(struct platform_device *pdev)

return 0;
fail_register:
mdiobus_free(bus->mii_bus);
smi_en.u64 = 0;
oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
return err;
Expand All @@ -89,7 +88,6 @@ static int octeon_mdiobus_remove(struct platform_device *pdev)
bus = platform_get_drvdata(pdev);

mdiobus_unregister(bus->mii_bus);
mdiobus_free(bus->mii_bus);
smi_en.u64 = 0;
oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
return 0;
Expand Down

0 comments on commit e1c38c2

Please sign in to comment.