[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJLPPeOsoGCaYxnDMHTfcJbTOXeJEJNxLj40D=310CvsQ@mail.gmail.com>
Date: Thu, 30 Jun 2022 12:27:02 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
syzbot <syzkaller@...glegroups.com>,
Petar Penkov <ppenkov@...atrix.com>
Subject: Re: [PATCH net 1/2] net: tun: avoid disabling NAPI twice
On Wed, Jun 29, 2022 at 8:19 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> 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")
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
> Reported-by: syzbot <syzkaller@...glegroups.com>
> Reported-by: Eric Dumazet <edumazet@...gle.com>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> Cc: Petar Penkov <ppenkov@...atrix.com>
> ---
> CC: ppenkov@...atrix.com
> ---
> drivers/net/tun.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index e2eb35887394..259b2b84b2b3 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -640,7 +640,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
> tun = rtnl_dereference(tfile->tun);
>
> if (tun && clean) {
> - tun_napi_disable(tfile);
> + if (!tfile->detached)
> + tun_napi_disable(tfile);
> tun_napi_del(tfile);
> }
>
> --
> 2.36.1
>
Powered by blists - more mailing lists