diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-03-10 12:28:27 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-03-10 12:28:27 +0300 |
commit | 6cbe9e4a228ce00b9fa10d56da6cb7985d7b10e9 (patch) | |
tree | f8e52ed2acd6316d0832f084b4c633f1d19079aa /drivers/vhost/vhost.c | |
parent | 29b75eb2d56a714190a93d7be4525e617591077a (diff) | |
parent | 8e0f93cda48ed054e1216bab5c60017e1a5fc1e8 (diff) | |
download | linux-6cbe9e4a228ce00b9fa10d56da6cb7985d7b10e9.tar.xz |
Merge branch 'linus' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index ad2146a9ab2d..236553e81027 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -1156,6 +1156,8 @@ int vhost_init_used(struct vhost_virtqueue *vq) { __virtio16 last_used_idx; int r; + bool is_le = vq->is_le; + if (!vq->private_data) { vq->is_le = virtio_legacy_is_little_endian(); return 0; @@ -1165,15 +1167,20 @@ int vhost_init_used(struct vhost_virtqueue *vq) r = vhost_update_used_flags(vq); if (r) - return r; + goto err; vq->signalled_used_valid = false; - if (!access_ok(VERIFY_READ, &vq->used->idx, sizeof vq->used->idx)) - return -EFAULT; + if (!access_ok(VERIFY_READ, &vq->used->idx, sizeof vq->used->idx)) { + r = -EFAULT; + goto err; + } r = __get_user(last_used_idx, &vq->used->idx); if (r) - return r; + goto err; vq->last_used_idx = vhost16_to_cpu(vq, last_used_idx); return 0; +err: + vq->is_le = is_le; + return r; } EXPORT_SYMBOL_GPL(vhost_init_used); |