summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/ezchip
diff options
context:
space:
mode:
authorPavel Skripkin <paskripkin@gmail.com>2021-06-18 19:14:31 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-19 21:46:00 +0300
commite4b8700e07a86e8eab6916aa5c5ba99042c34089 (patch)
treea50b6eca26ec724fea75553cc5a156871ed1e7f0 /drivers/net/ethernet/ezchip
parente3a5de6d81d8b2199935c7eb3f7d17a50a7075b7 (diff)
downloadlinux-e4b8700e07a86e8eab6916aa5c5ba99042c34089.tar.xz
net: ethernet: ezchip: fix UAF in nps_enet_remove
priv is netdev private data, but it is used after free_netdev(). It can cause use-after-free when accessing priv pointer. So, fix it by moving free_netdev() after netif_napi_del() call. Fixes: 0dd077093636 ("NET: Add ezchip ethernet driver") Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ezchip')
-rw-r--r--drivers/net/ethernet/ezchip/nps_enet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index e3954d8835e7..20d2c2bb26e4 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -642,8 +642,8 @@ static s32 nps_enet_remove(struct platform_device *pdev)
struct nps_enet_priv *priv = netdev_priv(ndev);
unregister_netdev(ndev);
- free_netdev(ndev);
netif_napi_del(&priv->napi);
+ free_netdev(ndev);
return 0;
}