aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Le Goater <clg@fr.ibm.com>2014-07-11 15:06:13 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2014-08-08 19:25:55 +1000
commit34df1ee6fbcd5fbd0ce002c55c7c32bf63d3e2c4 (patch)
tree1f3c971c18b35b0c7a6a981b902fec92166d2363
parent4087c952574f18106c5d9731d4573ce7e3c35f62 (diff)
downloadpowerpc-34df1ee6fbcd5fbd0ce002c55c7c32bf63d3e2c4.tar.gz
vhost: Byteswap virtqueue attributes fix
commit a9a8f7a56976 "vhost: Byteswap virtqueue attributes" missed a few byteswap in vhost_add_used(). This patches adds the vq_put_user() calls required when accessing data in the the guest memory. BZ: 108753 Branch: powerkvm-v2.1.1 Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org> (cherry picked from commit e7fb63f8f2444a8f687b53311d8e83267fcaa143) Signed-off-by: Scott Garfinkle <seg@us.ibm.com>
-rw-r--r--drivers/vhost/vhost.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 3072e902d63b59..a6d4fb67cf3489 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1407,17 +1407,17 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len)
/* The virtqueue contains a ring of used buffers. Get a pointer to the
* next entry in that used ring. */
used = &vq->used->ring[vq->last_used_idx % vq->num];
- if (__put_user(head, &used->id)) {
+ if (__vq_put_user(vq, head, &used->id)) {
vq_err(vq, "Failed to write used id");
return -EFAULT;
}
- if (__put_user(len, &used->len)) {
+ if (__vq_put_user(vq, len, &used->len)) {
vq_err(vq, "Failed to write used len");
return -EFAULT;
}
/* Make sure buffer is written before we update index. */
smp_wmb();
- if (__put_user(vq->last_used_idx + 1, &vq->used->idx)) {
+ if (__vq_put_user(vq, vq->last_used_idx + 1, &vq->used->idx)) {
vq_err(vq, "Failed to increment used idx");
return -EFAULT;
}