aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-11-26 00:57:27 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-28 11:27:01 -0500
commitbd97120fc3d1a11f3124c7c9ba1d91f51829eb85 (patch)
tree9b7dd4ce2b3a1be219f3b62098be892540765951 /drivers
parentc3b2c2581988d304127c2aa218430b5fca88ce56 (diff)
vhost: fix length for cross region descriptor
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>
Diffstat (limited to 'drivers')
-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 99ac2cb08b43..dedaf81d8f36 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1076,7 +1076,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
1076 } 1076 }
1077 _iov = iov + ret; 1077 _iov = iov + ret;
1078 size = reg->memory_size - addr + reg->guest_phys_addr; 1078 size = reg->memory_size - addr + reg->guest_phys_addr;
1079 _iov->iov_len = min((u64)len, size); 1079 _iov->iov_len = min((u64)len - s, size);
1080 _iov->iov_base = (void __user *)(unsigned long) 1080 _iov->iov_base = (void __user *)(unsigned long)
1081 (reg->userspace_addr + addr - reg->guest_phys_addr); 1081 (reg->userspace_addr + addr - reg->guest_phys_addr);
1082 s += size; 1082 s += size;