From: Marc-André Lureau Date: Tue, 26 Jul 2016 21:15:27 +0000 (+0400) Subject: vhost: do not update last avail idx on get_vring_base() failure X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~6^2~13^2~6^2~75^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=499c557975275dba23fbf8f23880815d019ce663;p=sdk%2Femulator%2Fqemu.git 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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