[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221108174057.2336512c@kernel.org>
Date: Tue, 8 Nov 2022 17:40:57 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
eric.dumazet@...il.com, syzbot <syzkaller@...glegroups.com>,
Wang Yufen <wangyufen@...wei.com>
Subject: Re: [PATCH net] net: tun: call napi_schedule_prep() to ensure we
own a napi
On Mon, 7 Nov 2022 18:00:11 +0000 Eric Dumazet wrote:
> if (unlikely(headlen > skb_headlen(skb))) {
> + WARN_ON_ONCE(1);
> + err = -ENOMEM;
> dev_core_stats_rx_dropped_inc(tun->dev);
> +napi_busy:
> napi_free_frags(&tfile->napi);
> rcu_read_unlock();
> mutex_unlock(&tfile->napi_mutex);
> - WARN_ON(1);
> - return -ENOMEM;
> + return err;
> }
>
> - local_bh_disable();
> - napi_gro_frags(&tfile->napi);
> - napi_complete(&tfile->napi);
> - local_bh_enable();
> + if (likely(napi_schedule_prep(&tfile->napi))) {
> + local_bh_disable();
> + napi_gro_frags(&tfile->napi);
> + napi_complete(&tfile->napi);
> + local_bh_enable();
> + } else {
> + err = -EBUSY;
> + goto napi_busy;
This can only hit if someone else is trying to detach / napi_disable()
at the same time?
> + }
Powered by blists - more mailing lists