netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: wangyunjian <wangyunjian@huawei.com>,
	netdev@vger.kernel.org, mst@redhat.com,
	willemdebruijn.kernel@gmail.com
Cc: virtualization@lists.linux-foundation.org,
	jerry.lilijun@huawei.com, chenchanghu@huawei.com,
	xudingke@huawei.com, brian.huangbin@huawei.com
Subject: Re: [PATCH net v2] tun: fix return value when the number of iovs exceeds MAX_SKB_FRAGS
Date: Fri, 25 Dec 2020 14:18:03 +0800	[thread overview]
Message-ID: <b9de1be1-159f-455d-445a-c37edae32574@redhat.com> (raw)
In-Reply-To: <1608864736-24332-1-git-send-email-wangyunjian@huawei.com>


On 2020/12/25 上午10:52, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> Currently the tun_napi_alloc_frags() function returns -ENOMEM when the
> number of iovs exceeds MAX_SKB_FRAGS + 1. However this is inappropriate,
> we should use -EMSGSIZE instead of -ENOMEM.
>
> The following distinctions are matters:
> 1. the caller need to drop the bad packet when -EMSGSIZE is returned,
>     which means meeting a persistent failure.
> 2. the caller can try again when -ENOMEM is returned, which means
>     meeting a transient failure.
>
> Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver")
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> Acked-by: Willem de Bruijn <willemb@google.com>
> ---
> v2:
>    * update commit log suggested by Willem de Bruijn
> ---
>   drivers/net/tun.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 2dc1988a8973..15c6dd7fb04c 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1365,7 +1365,7 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile,
>   	int i;
>   
>   	if (it->nr_segs > MAX_SKB_FRAGS + 1)
> -		return ERR_PTR(-ENOMEM);
> +		return ERR_PTR(-EMSGSIZE);
>   
>   	local_bh_disable();
>   	skb = napi_get_frags(&tfile->napi);


Acked-by: Jason Wang <jasowang@redhat.com>



  reply	other threads:[~2020-12-25  6:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25  2:52 [PATCH net v2] tun: fix return value when the number of iovs exceeds MAX_SKB_FRAGS wangyunjian
2020-12-25  6:18 ` Jason Wang [this message]
2020-12-27  9:40 ` Michael S. Tsirkin
2020-12-28 21:43 ` Jakub Kicinski

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=b9de1be1-159f-455d-445a-c37edae32574@redhat.com \
    --to=jasowang@redhat.com \
    --cc=brian.huangbin@huawei.com \
    --cc=chenchanghu@huawei.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wangyunjian@huawei.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=xudingke@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).