diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2012-11-26 05:57:27 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-04 06:06:43 +0800 |
commit | 94dcb26bbbed1851e0a7fb16165207c2c61e545f (patch) | |
tree | 3bbf5cc7eb75e9cdb8f3c5763546767f5a4a9d28 /drivers/vhost | |
parent | 7e5e167c5c1b44f408fa8f8a8f062f234cd0f0d6 (diff) |
vhost: fix length for cross region descriptor
commit bd97120fc3d1a11f3124c7c9ba1d91f51829eb85 upstream.
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>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vhost.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 51e4c1eeec4..1a9e2a9b856 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -1074,7 +1074,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; |