Skip to content

Commit 3b9bc84

Browse files
committed
net: tun: unlink NAPI from device on destruction
Syzbot found a race between tun file and device destruction. NAPIs live in struct tun_file which can get destroyed before the netdev so we have to del them explicitly. The current code is missing deleting the NAPI if the queue was detached first. Fixes: 9431709 ("tun: enable NAPI for TUN/TAP driver") Reported-by: syzbot+b75c138e9286ac742647@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20220623042039.2274708-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 6f0012e commit 3b9bc84

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/tun.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ static void tun_detach_all(struct net_device *dev)
727727
sock_put(&tfile->sk);
728728
}
729729
list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) {
730+
tun_napi_del(tfile);
730731
tun_enable_queue(tfile);
731732
tun_queue_purge(tfile);
732733
xdp_rxq_info_unreg(&tfile->xdp_rxq);

0 commit comments

Comments
 (0)