* [PATCH] vhost: fix length for cross region descriptor
@ 2012-11-26 15:57 Michael S. Tsirkin
2012-11-27 5:47 ` Jason Wang
2012-11-28 16:27 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2012-11-26 15:57 UTC (permalink / raw)
To: netdev, David Miller; +Cc: Jason Wang, linux-kernel
If a single descriptor crosses a region, the
second chunk length should be decremented
by size translated so far, instead it includes
the full descriptor length.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/vhost/vhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ef8f598..5a3d0f1 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1049,7 +1049,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
}
_iov = iov + ret;
size = reg->memory_size - addr + reg->guest_phys_addr;
- _iov->iov_len = min((u64)len, size);
+ _iov->iov_len = min((u64)len - s, size);
_iov->iov_base = (void __user *)(unsigned long)
(reg->userspace_addr + addr - reg->guest_phys_addr);
s += size;
--
MST
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost: fix length for cross region descriptor
2012-11-26 15:57 [PATCH] vhost: fix length for cross region descriptor Michael S. Tsirkin
@ 2012-11-27 5:47 ` Jason Wang
2012-11-28 16:27 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2012-11-27 5:47 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, David Miller, linux-kernel
On 11/26/2012 11:57 PM, Michael S. Tsirkin wrote:
> If a single descriptor crosses a region, the
> second chunk length should be decremented
> by size translated so far, instead it includes
> the full descriptor length.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/vhost.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index ef8f598..5a3d0f1 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1049,7 +1049,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
> }
> _iov = iov + ret;
> size = reg->memory_size - addr + reg->guest_phys_addr;
> - _iov->iov_len = min((u64)len, size);
> + _iov->iov_len = min((u64)len - s, size);
> _iov->iov_base = (void __user *)(unsigned long)
> (reg->userspace_addr + addr - reg->guest_phys_addr);
> s += size;
Acked-by: Jason Wang <jasowang@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost: fix length for cross region descriptor
2012-11-26 15:57 [PATCH] vhost: fix length for cross region descriptor Michael S. Tsirkin
2012-11-27 5:47 ` Jason Wang
@ 2012-11-28 16:27 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-11-28 16:27 UTC (permalink / raw)
To: mst; +Cc: netdev, jasowang, linux-kernel
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Mon, 26 Nov 2012 17:57:27 +0200
> If a single descriptor crosses a region, the
> second chunk length should be decremented
> by size translated so far, instead it includes
> the full descriptor length.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-28 16:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-26 15:57 [PATCH] vhost: fix length for cross region descriptor Michael S. Tsirkin
2012-11-27 5:47 ` Jason Wang
2012-11-28 16:27 ` David Miller
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).