Skip to content

Commit

Permalink
net: dpaa2-eth: fix use-after-free in dpaa2_eth_remove
Browse files Browse the repository at this point in the history
Access to netdev after free_netdev() will cause use-after-free bug.
Move debug log before free_netdev() call to avoid it.

Fixes: 7472dd9 ("staging: fsl-dpaa2/eth: Move print message")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
pskrgag authored and davem330 committed Nov 17, 2021
1 parent f77b83b commit 9b5a333
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -4550,10 +4550,10 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)

fsl_mc_portal_free(priv->mc_io);

free_netdev(net_dev);

dev_dbg(net_dev->dev.parent, "Removed interface %s\n", net_dev->name);

free_netdev(net_dev);

return 0;
}

Expand Down

0 comments on commit 9b5a333

Please sign in to comment.