diff options
author | Pavel Skripkin <paskripkin@gmail.com> | 2021-11-16 18:17:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-11-25 11:48:39 +0300 |
commit | 32d4686224744819ddcae58b666c21d2a4ef4c88 (patch) | |
tree | 3bbc07bc11bad4956ca9f7e8a4bff2f9689061d5 | |
parent | 7cc1c7da94eae9b35517a0a96b0dae2ca382700d (diff) | |
download | linux-32d4686224744819ddcae58b666c21d2a4ef4c88.tar.xz |
net: dpaa2-eth: fix use-after-free in dpaa2_eth_remove
[ Upstream commit 9b5a333272a48c2f8b30add7a874e46e8b26129c ]
Access to netdev after free_netdev() will cause use-after-free bug.
Move debug log before free_netdev() call to avoid it.
Fixes: 7472dd9f6499 ("staging: fsl-dpaa2/eth: Move print message")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 7065c71ed7b8..f3e443f2d9cf 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -4538,10 +4538,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; } |