summaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-07-27 01:15:27 +0400
committerMichael S. Tsirkin <mst@redhat.com>2016-07-29 05:47:17 +0300
commit499c557975275dba23fbf8f23880815d019ce663 (patch)
treeb73d31678f2da3f6b44b8bed56fee5873cc7203d /hw/virtio
parent950d94ba0671e7f154a9e87a277f8efbddcee28f (diff)
downloadqemu-499c557975275dba23fbf8f23880815d019ce663.tar.gz
qemu-499c557975275dba23fbf8f23880815d019ce663.tar.bz2
qemu-499c557975275dba23fbf8f23880815d019ce663.zip
vhost: do not update last avail idx on get_vring_base() failure
The state.num value will probably be 0 in this case, but that doesn't make sense to update. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index b0e8ecce60..3d0c807d0e 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -945,8 +945,9 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
r = dev->vhost_ops->vhost_get_vring_base(dev, &state);
if (r < 0) {
VHOST_OPS_DEBUG("vhost VQ %d ring restore failed: %d", idx, r);
+ } else {
+ virtio_queue_set_last_avail_idx(vdev, idx, state.num);
}
- virtio_queue_set_last_avail_idx(vdev, idx, state.num);
virtio_queue_invalidate_signalled_used(vdev, idx);
/* In the cross-endian case, we need to reset the vring endianness to