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 <[email protected]> Reported-by: Eric Dumazet <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9c5de24 commit ff1fa20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)