mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
forcedeth: fix UAF of txrx_stats in nv_remove
nv_remove() frees the per-CPU txrx_stats before unregister_netdev().
Until unregister completes, ndo_get_stats64, the NAPI/xmit data path,
and nv_close()/drain may still access txrx_stats, leading to a
use-after-free.
Free the stats only after unregister_netdev().
Fixes: f4b633b911 ("forcedeth: use per cpu to collect xmit/recv statistics")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Link: https://patch.msgid.link/20260723092637.2135095-1-chenguang.zhao@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5546da8689
commit
22666ba142
|
|
@ -6187,10 +6187,10 @@ static void nv_remove(struct pci_dev *pci_dev)
|
|||
struct net_device *dev = pci_get_drvdata(pci_dev);
|
||||
struct fe_priv *np = netdev_priv(dev);
|
||||
|
||||
free_percpu(np->txrx_stats);
|
||||
|
||||
unregister_netdev(dev);
|
||||
|
||||
free_percpu(np->txrx_stats);
|
||||
|
||||
nv_restore_mac_addr(pci_dev);
|
||||
|
||||
/* restore any phy related changes */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user