summaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2018-04-11 15:30:38 +0200
committerDavid S. Miller <davem@davemloft.net>2018-04-11 10:52:34 -0400
commit7ced6c98c7ab7a1f6743931e28671b833af79b1e (patch)
tree83c1da2c76b6b049915063144677b9b77a9ba122 /drivers/vhost
parent98239c9096ed1dad97f01c66aa6d8b6e9be9029a (diff)
downloadlinux-0-day-7ced6c98c7ab7a1f6743931e28671b833af79b1e.tar.gz
linux-0-day-7ced6c98c7ab7a1f6743931e28671b833af79b1e.tar.xz
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: f88949138058 ("vhost: introduce O(1) vq metadata cache") Signed-off-by: Eric Auger <eric.auger@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost')
-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 bec722e41f583..f44aead98d604 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to,
struct iov_iter t;
void __user *uaddr = vhost_vq_meta_fetch(vq,
(u64)(uintptr_t)to, size,
- VHOST_ADDR_DESC);
+ VHOST_ADDR_USED);
if (uaddr)
return __copy_to_user(uaddr, from, size);