Skip to content

Commit ff1fa20

Browse files
committed
net: tun: avoid disabling NAPI twice
Eric reports that syzbot made short work out of my speculative fix. Indeed when queue gets detached its tfile->tun remains, so we would try to stop NAPI twice with a detach(), close() sequence. Alternative fix would be to move tun_napi_disable() to tun_detach_all() and let the NAPI run after the queue has been detached. Fixes: a8fc8cb ("net: tun: stop NAPI when detaching queues") Reported-by: syzbot <syzkaller@googlegroups.com> Reported-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20220629181911.372047-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9c5de24 commit ff1fa20

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/net/tun.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
640640
tun = rtnl_dereference(tfile->tun);
641641

642642
if (tun && clean) {
643-
tun_napi_disable(tfile);
643+
if (!tfile->detached)
644+
tun_napi_disable(tfile);
644645
tun_napi_del(tfile);
645646
}
646647

0 commit comments

Comments
 (0)