All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	syzbot <syzkaller@googlegroups.com>,
	Wang Yufen <wangyufen@huawei.com>
Subject: Re: [PATCH net] net: tun: call napi_schedule_prep() to ensure we own a napi
Date: Tue, 8 Nov 2022 17:40:57 -0800	[thread overview]
Message-ID: <20221108174057.2336512c@kernel.org> (raw)
In-Reply-To: <20221107180011.188437-1-edumazet@google.com>

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?

> +		}

  reply	other threads:[~2022-11-09  1:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 18:00 [PATCH net] net: tun: call napi_schedule_prep() to ensure we own a napi Eric Dumazet
2022-11-09  1:40 ` Jakub Kicinski [this message]
2022-11-09  1:45   ` Eric Dumazet
2022-11-09  2:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221108174057.2336512c@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzkaller@googlegroups.com \
    --cc=wangyufen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.