Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5eac00ef authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Greg Kroah-Hartman
Browse files

net: tun: avoid disabling NAPI twice



commit ff1fa2081d173b01cebe2fbf0a2d0f1cee9ce4b5 upstream.

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: a8fc8cb5692a ("net: tun: stop NAPI when detaching queues")
Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
Reported-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220629181911.372047-1-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f968872
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -696,6 +696,7 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
	tun = rtnl_dereference(tfile->tun);

	if (tun && clean) {
		if (!tfile->detached)
			tun_napi_disable(tfile);
		tun_napi_del(tfile);
	}