Skip to content

Commit bd97120

Browse files
mstsirkindavem330
authored andcommitted
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>
1 parent c3b2c25 commit bd97120

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: drivers/vhost/vhost.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
10761076
}
10771077
_iov = iov + ret;
10781078
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);
10801080
_iov->iov_base = (void __user *)(unsigned long)
10811081
(reg->userspace_addr + addr - reg->guest_phys_addr);
10821082
s += size;

0 commit comments

Comments
 (0)