Commit 7ced6c98 authored by Eric Auger's avatar Eric Auger Committed by David S. Miller

vhost: Fix vhost_copy_to_user()

vhost_copy_to_user is used to copy vring used elements to userspace.
We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC.

Fixes: f8894913 ("vhost: introduce O(1) vq metadata cache")
Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 98239c90
...@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to, ...@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to,
struct iov_iter t; struct iov_iter t;
void __user *uaddr = vhost_vq_meta_fetch(vq, void __user *uaddr = vhost_vq_meta_fetch(vq,
(u64)(uintptr_t)to, size, (u64)(uintptr_t)to, size,
VHOST_ADDR_DESC); VHOST_ADDR_USED);
if (uaddr) if (uaddr)
return __copy_to_user(uaddr, from, size); return __copy_to_user(uaddr, from, size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment