mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
tun: Drain eBPF RCU callbacks on module exit
Replacing or clearing a TUN eBPF program defers its destruction to
tun_prog_free(). In the device teardown path, tun_free_netdev() can queue
this callback as a private destructor. The rcu_barrier() in
netdev_run_todo() runs before private destructors, so it cannot drain the
new callback.
After the last file or persistent-device reference is released, tun can
therefore unload before the callback runs. Drain outstanding callbacks at
the end of module cleanup so they cannot execute from freed module text.
These issues were found by a static analysis method.
Cc: stable+noautosel@kernel.org # needs real net-admin (non-ns)
Fixes: 96f8406162 ("tun: add eBPF based queue selection method")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261003093822.544964-1-yaojiale02@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
921f4ad115
commit
28eef87694
|
|
@ -3855,6 +3855,7 @@ static void __exit tun_cleanup(void)
|
|||
misc_deregister(&tun_miscdev);
|
||||
rtnl_link_unregister(&tun_link_ops);
|
||||
unregister_netdevice_notifier(&tun_notifier_block);
|
||||
rcu_barrier();
|
||||
}
|
||||
|
||||
/* Get an underlying socket object from tun file. Returns error unless file is
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user