qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] net: assert that tx packets have nonzero si


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH 1/2] net: assert that tx packets have nonzero size
Date: Tue, 23 Jul 2019 11:38:19 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0


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 <address@hidden>
---
  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;
      }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]