From: "Michael S. Tsirkin" <mst@redhat.com>
To: wangyunjian <wangyunjian@huawei.com>
Cc: netdev@vger.kernel.org, jasowang@redhat.com,
willemdebruijn.kernel@gmail.com,
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: Sun, 27 Dec 2020 04:40:17 -0500 [thread overview]
Message-ID: <20201227044010-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1608864736-24332-1-git-send-email-wangyunjian@huawei.com>
On Fri, Dec 25, 2020 at 10:52:16AM +0800, 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>
Acked-by: Michael S. Tsirkin <mst@redhat.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);
> --
> 2.23.0
next prev parent reply other threads:[~2020-12-27 9:43 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
2020-12-27 9:40 ` Michael S. Tsirkin [this message]
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=20201227044010-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=brian.huangbin@huawei.com \
--cc=chenchanghu@huawei.com \
--cc=jasowang@redhat.com \
--cc=jerry.lilijun@huawei.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).