提交 5db7fd4a 编写于 作者: P Pavel Skripkin 提交者: Zheng Zengkai

net: ethernet: ezchip: fix UAF in nps_enet_remove

stable inclusion
from stable-5.10.50
commit 161f8b73da68918ccfe8210c9f1a497e8a5e84da
bugzilla: 174522 https://gitee.com/openeuler/kernel/issues/I4DNFY

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=161f8b73da68918ccfe8210c9f1a497e8a5e84da

--------------------------------

[ Upstream commit e4b8700e ]

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: 0dd07709 ("NET: Add ezchip ethernet driver")
Signed-off-by: NPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 9d2eaabd
...@@ -645,8 +645,8 @@ static s32 nps_enet_remove(struct platform_device *pdev) ...@@ -645,8 +645,8 @@ static s32 nps_enet_remove(struct platform_device *pdev)
struct nps_enet_priv *priv = netdev_priv(ndev); struct nps_enet_priv *priv = netdev_priv(ndev);
unregister_netdev(ndev); unregister_netdev(ndev);
free_netdev(ndev);
netif_napi_del(&priv->napi); netif_napi_del(&priv->napi);
free_netdev(ndev);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册