diff options
author | Eric Auger <eric.auger@redhat.com> | 2018-04-11 16:30:38 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-19 09:56:16 +0300 |
commit | 2ea541eb406468db42c25507c1df3a0d92fa0329 (patch) | |
tree | 2ecbf28c40d925c4fdb0d0bfdaa0e7f7ac45eb52 /drivers/vhost | |
parent | e240ffd5a3bea24906ae2cd375ec7a6f4810a77d (diff) | |
download | linux-2ea541eb406468db42c25507c1df3a0d92fa0329.tar.xz |
vhost: Fix vhost_copy_to_user()
[ Upstream commit 7ced6c98c7ab7a1f6743931e28671b833af79b1e ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vhost.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 40552a043c86..8e3ca4400766 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -756,7 +756,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); |