* [PATCH net] vhost_net: do not report a used len larger than receive buffer size
@ 2014-02-12 5:57 Jason Wang
2014-02-12 11:52 ` Michael S. Tsirkin
0 siblings, 1 reply; 2+ messages in thread
From: Jason Wang @ 2014-02-12 5:57 UTC (permalink / raw)
To: mst, kvm, virtio-dev, virtualization, netdev, linux-kernel
Currently, even if the packet were truncated by lower socket, we still
report the packet size as the used len which may confuse guest
driver. Fixes this by returning the size of guest receive buffer instead.
Fixes 3a4d5c94e959359ece6d6b55045c3f046677f55c
(vhost_net: a kernel-level virtio server)
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 9a68409..06268a0 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -525,7 +525,8 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
++headcount;
seg += in;
}
- heads[headcount - 1].len += datalen;
+ if (likely(datalen < 0))
+ heads[headcount - 1].len += datalen;
*iovcount = seg;
if (unlikely(log))
*log_num = nlogs;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] vhost_net: do not report a used len larger than receive buffer size
2014-02-12 5:57 [PATCH net] vhost_net: do not report a used len larger than receive buffer size Jason Wang
@ 2014-02-12 11:52 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2014-02-12 11:52 UTC (permalink / raw)
To: Jason Wang; +Cc: virtio-dev, netdev, linux-kernel, kvm, virtualization
On Wed, Feb 12, 2014 at 01:57:46PM +0800, Jason Wang wrote:
> Currently, even if the packet were truncated by lower socket, we still
> report the packet size as the used len which may confuse guest
> driver. Fixes this by returning the size of guest receive buffer instead.
>
> Fixes 3a4d5c94e959359ece6d6b55045c3f046677f55c
> (vhost_net: a kernel-level virtio server)
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
As discussed off-line:
NAK
and a fixed version will be sent.
> ---
> drivers/vhost/net.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 9a68409..06268a0 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -525,7 +525,8 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
> ++headcount;
> seg += in;
> }
> - heads[headcount - 1].len += datalen;
> + if (likely(datalen < 0))
> + heads[headcount - 1].len += datalen;
> *iovcount = seg;
> if (unlikely(log))
> *log_num = nlogs;
> --
> 1.8.3.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-12 11:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 5:57 [PATCH net] vhost_net: do not report a used len larger than receive buffer size Jason Wang
2014-02-12 11:52 ` Michael S. Tsirkin
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).