net: ethernet: ezchip: fix UAF in nps_enet_remove
authorPavel Skripkin <paskripkin@gmail.com>
Fri, 18 Jun 2021 16:14:31 +0000 (19:14 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:17:37 +0000 (16:17 +0200)
commita00994e372f4a996e9c36b1eb8c3d7a6ac67e3f7
tree086626a3353e9f5368a669ca438ff9c9b7cbb757
parent9cddf9f7f18da6e35cb7a80ce0e7ebc42048af8b
net: ethernet: ezchip: fix UAF in nps_enet_remove

[ Upstream commit e4b8700e07a86e8eab6916aa5c5ba99042c34089 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/ezchip/nps_enet.c