Skip to content

Commit ad297cd

Browse files
pskrgagdavem330
authored andcommitted
net: qcom/emac: fix UAF in emac_remove
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: 54e19bc ("net: qcom/emac: do not use devm on internal phy pdev") Signed-off-by: Pavel Skripkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c78eaee commit ad297cd

File tree

1 file changed

+2
-1
lines changed
  • drivers/net/ethernet/qualcomm/emac

1 file changed

+2
-1
lines changed

drivers/net/ethernet/qualcomm/emac/emac.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,13 @@ static int emac_remove(struct platform_device *pdev)
735735

736736
put_device(&adpt->phydev->mdio.dev);
737737
mdiobus_unregister(adpt->mii_bus);
738-
free_netdev(netdev);
739738

740739
if (adpt->phy.digital)
741740
iounmap(adpt->phy.digital);
742741
iounmap(adpt->phy.base);
743742

743+
free_netdev(netdev);
744+
744745
return 0;
745746
}
746747

0 commit comments

Comments
 (0)