提交 e3bf3df8 编写于 作者: A Al Viro

[vhost] fix 'direction' argument of iov_iter_{init,bvec}()

READ means "data destination", WRITE - "data source".
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 b676668d
...@@ -832,7 +832,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to, ...@@ -832,7 +832,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to,
VHOST_ACCESS_WO); VHOST_ACCESS_WO);
if (ret < 0) if (ret < 0)
goto out; goto out;
iov_iter_init(&t, WRITE, vq->iotlb_iov, ret, size); iov_iter_init(&t, READ, vq->iotlb_iov, ret, size);
ret = copy_to_iter(from, size, &t); ret = copy_to_iter(from, size, &t);
if (ret == size) if (ret == size)
ret = 0; ret = 0;
...@@ -871,7 +871,7 @@ static int vhost_copy_from_user(struct vhost_virtqueue *vq, void *to, ...@@ -871,7 +871,7 @@ static int vhost_copy_from_user(struct vhost_virtqueue *vq, void *to,
(unsigned long long) size); (unsigned long long) size);
goto out; goto out;
} }
iov_iter_init(&f, READ, vq->iotlb_iov, ret, size); iov_iter_init(&f, WRITE, vq->iotlb_iov, ret, size);
ret = copy_from_iter(to, size, &f); ret = copy_from_iter(to, size, &f);
if (ret == size) if (ret == size)
ret = 0; ret = 0;
...@@ -2135,7 +2135,7 @@ static int get_indirect(struct vhost_virtqueue *vq, ...@@ -2135,7 +2135,7 @@ static int get_indirect(struct vhost_virtqueue *vq,
vq_err(vq, "Translation failure %d in indirect.\n", ret); vq_err(vq, "Translation failure %d in indirect.\n", ret);
return ret; return ret;
} }
iov_iter_init(&from, READ, vq->indirect, ret, len); iov_iter_init(&from, WRITE, vq->indirect, ret, len);
count = len / sizeof desc; count = len / sizeof desc;
/* Buffers are chained via a 16 bit next field, so /* Buffers are chained via a 16 bit next field, so
* we can have at most 2^16 of these. */ * we can have at most 2^16 of these. */
......
...@@ -1162,7 +1162,7 @@ static inline int copy_from_iotlb(const struct vringh *vrh, void *dst, ...@@ -1162,7 +1162,7 @@ static inline int copy_from_iotlb(const struct vringh *vrh, void *dst,
else if (ret < 0) else if (ret < 0)
return ret; return ret;
iov_iter_bvec(&iter, READ, iov, ret, translated); iov_iter_bvec(&iter, WRITE, iov, ret, translated);
ret = copy_from_iter(dst, translated, &iter); ret = copy_from_iter(dst, translated, &iter);
if (ret < 0) if (ret < 0)
...@@ -1195,7 +1195,7 @@ static inline int copy_to_iotlb(const struct vringh *vrh, void *dst, ...@@ -1195,7 +1195,7 @@ static inline int copy_to_iotlb(const struct vringh *vrh, void *dst,
else if (ret < 0) else if (ret < 0)
return ret; return ret;
iov_iter_bvec(&iter, WRITE, iov, ret, translated); iov_iter_bvec(&iter, READ, iov, ret, translated);
ret = copy_to_iter(src, translated, &iter); ret = copy_to_iter(src, translated, &iter);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册