aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin2012-11-25 23:57:27 -0600
committerGreg Kroah-Hartman2013-03-03 16:09:05 -0600
commit603b86549a4d6928d1059b19df2dfc5d61070533 (patch)
tree5625bc309beed5f00ffd91685eff22ea1364f693
parent4bf6d0956ad678f3ef59362cb41dae05a2259f78 (diff)
downloadkernel-common-603b86549a4d6928d1059b19df2dfc5d61070533.tar.gz
kernel-common-603b86549a4d6928d1059b19df2dfc5d61070533.tar.xz
kernel-common-603b86549a4d6928d1059b19df2dfc5d61070533.zip
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>
-rw-r--r--drivers/vhost/vhost.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 61047fe3120..e3fac280e46 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -986,7 +986,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
986 } 986 }
987 _iov = iov + ret; 987 _iov = iov + ret;
988 size = reg->memory_size - addr + reg->guest_phys_addr; 988 size = reg->memory_size - addr + reg->guest_phys_addr;
989 _iov->iov_len = min((u64)len, size); 989 _iov->iov_len = min((u64)len - s, size);
990 _iov->iov_base = (void __user *)(unsigned long) 990 _iov->iov_base = (void __user *)(unsigned long)
991 (reg->userspace_addr + addr - reg->guest_phys_addr); 991 (reg->userspace_addr + addr - reg->guest_phys_addr);
992 s += size; 992 s += size;