mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
net: qcom/emac: fix UAF in emac_remove
commitad297cd2dbupstream. adpt is netdev private data and it cannot be used after free_netdev() call. Using adpt after free_netdev() can cause UAF bug. Fix it by moving free_netdev() at the end of the function. Fixes:54e19bc74f("net: qcom/emac: do not use devm on internal phy pdev") Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
dbbf5b957b
commit
b560521eca
|
|
@ -735,12 +735,13 @@ static int emac_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
put_device(&adpt->phydev->mdio.dev);
|
put_device(&adpt->phydev->mdio.dev);
|
||||||
mdiobus_unregister(adpt->mii_bus);
|
mdiobus_unregister(adpt->mii_bus);
|
||||||
free_netdev(netdev);
|
|
||||||
|
|
||||||
if (adpt->phy.digital)
|
if (adpt->phy.digital)
|
||||||
iounmap(adpt->phy.digital);
|
iounmap(adpt->phy.digital);
|
||||||
iounmap(adpt->phy.base);
|
iounmap(adpt->phy.base);
|
||||||
|
|
||||||
|
free_netdev(netdev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user