From: Lei Yang <leiyang@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: qemu-devel@nongnu.org, jasowang@redhat.com, d-tatianin@yandex-team.ru
Subject: Re: [PATCH v2] net/tap: drop too small packets
Date: Fri, 18 Jul 2025 16:28:02 +0800 [thread overview]
Message-ID: <CAPpAL=wghDOvxdiprfTmB+B=PFMhz3Js3RmZqOq_KEV0xCzZ6Q@mail.gmail.com> (raw)
In-Reply-To: <20250716072854.13403-1-vsementsov@yandex-team.ru>
[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]
Tested this patch v2 again,everything works fine.
Tested-by: Lei Yang <leiyang@redhat.com>
On Wed, Jul 16, 2025 at 3:29 PM Vladimir Sementsov-Ogievskiy <
vsementsov@yandex-team.ru> wrote:
> Theoretically tap_read_packet() may return size less than
> s->host_vnet_hdr_len, and next, we'll work with negative size
> (in case of !s->using_vnet_hdr). Let's avoid it.
>
> Don't proceed with size == s->host_vnet_hdr_len as well in case
> of !s->using_vnet_hdr, it doesn't make sense.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>
> v2: change "<" -> "<="
>
> net/tap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/net/tap.c b/net/tap.c
> index 23536c09b46..2a859360193 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -190,6 +190,11 @@ static void tap_send(void *opaque)
> break;
> }
>
> + if (s->host_vnet_hdr_len && size <= s->host_vnet_hdr_len) {
> + /* Invalid packet */
> + break;
> + }
> +
> if (s->host_vnet_hdr_len && !s->using_vnet_hdr) {
> buf += s->host_vnet_hdr_len;
> size -= s->host_vnet_hdr_len;
> --
> 2.48.1
>
>
[-- Attachment #2: Type: text/html, Size: 1879 bytes --]
prev parent reply other threads:[~2025-07-18 8:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 7:28 [PATCH v2] net/tap: drop too small packets Vladimir Sementsov-Ogievskiy
2025-07-18 8:28 ` Lei Yang [this message]
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='CAPpAL=wghDOvxdiprfTmB+B=PFMhz3Js3RmZqOq_KEV0xCzZ6Q@mail.gmail.com' \
--to=leiyang@redhat.com \
--cc=d-tatianin@yandex-team.ru \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/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).