mirror of
https://github.com/torvalds/linux.git
synced 2026-06-09 23:23:53 +02:00
vhost: fix length for cross region descriptor
commit bd97120fc3 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>
This commit is contained in:
parent
7e5e167c5c
commit
94dcb26bbb
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user