[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b04b3823c002aac127c16472b150466afe9b38a9.1624032669.git.paskripkin@gmail.com>
Date: Fri, 18 Jun 2021 19:14:31 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: davem@...emloft.net, kuba@...nel.org, andrew@...n.ch,
michael@...le.cc, abrodkin@...opsys.com, talz@...hip.com,
noamc@...hip.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
Pavel Skripkin <paskripkin@...il.com>
Subject: [PATCH 1/3] 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@...il.com>
---
drivers/net/ethernet/ezchip/nps_enet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
2.32.0
Powered by blists - more mailing lists