From: Jason Wang <jasowang@redhat.com>
To: "Oleinik, Alexander" <alxndr@bu.edu>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"bsd@redhat.com" <bsd@redhat.com>,
"stefanha@redhat.com" <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] net: assert that tx packets have nonzero size
Date: Tue, 23 Jul 2019 11:38:19 +0800 [thread overview]
Message-ID: <6342b3c5-0cb2-74ba-89f0-6d28ef859c70@redhat.com> (raw)
In-Reply-To: <20190719185158.20316-2-alxndr@bu.edu>
On 2019/7/20 上午2:52, Oleinik, Alexander wrote:
> Virtual devices should not try to send zero-sized packets. The caller
> should check the size prior to calling qemu_sendv_packet_async.
>
> Signed-off-by: Alexander Oleinik <alxndr@bu.edu>
> ---
> net/net.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/net.c b/net/net.c
> index 7d4098254f..fad20bc611 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -741,6 +741,9 @@ ssize_t qemu_sendv_packet_async(NetClientState *sender,
> size_t size = iov_size(iov, iovcnt);
> int ret;
>
> + /* 0-sized packets are unsupported. Check size in the caller */
> + assert(size);
Can this be triggered through a buggy device by guest? If yes, we need
avoid using assert() here.
Thanks
> +
> if (size > NET_BUFSIZE) {
> return size;
> }
next prev parent reply other threads:[~2019-07-23 3:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 18:52 [Qemu-devel] [PATCH 0/2] Avoid sending zero-size packets Oleinik, Alexander
2019-07-19 18:52 ` [Qemu-devel] [PATCH 1/2] net: assert that tx packets have nonzero size Oleinik, Alexander
2019-07-22 7:17 ` Stefan Hajnoczi
2019-07-23 3:38 ` Jason Wang [this message]
2019-07-26 14:42 ` Oleinik, Alexander
2019-07-19 18:52 ` [Qemu-devel] [PATCH 2/2] virtio-net: check that tx packet has positive size Oleinik, Alexander
2019-07-22 7:22 ` Stefan Hajnoczi
2019-07-20 1:00 ` [Qemu-devel] [PATCH 0/2] Avoid sending zero-size packets no-reply
2019-07-22 10:47 ` Philippe Mathieu-Daudé
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=6342b3c5-0cb2-74ba-89f0-6d28ef859c70@redhat.com \
--to=jasowang@redhat.com \
--cc=alxndr@bu.edu \
--cc=bsd@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).