From: Ni Xun Date: Thu, 9 Jun 2022 13:10:12 +0000 (+0800) Subject: vhost: also check queue state in the vhost_dev_set_log error routine X-Git-Tag: v7.1.0-rc0~59^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ce305c8beb9ba7edacd0585139cce56a195c1da;p=thirdparty%2Fqemu.git vhost: also check queue state in the vhost_dev_set_log error routine When check queue state in the vhost_dev_set_log routine, it miss the error routine check, this patch also check queue state in error case. Fixes: 1e5a050f5798 ("check queue state in the vhost_dev_set_log routine") Signed-off-by: Ni Xun Reviewed-by: Zhigang Lu Message-Id: Reviewed-by: Michael S. Tsirkin Acked-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index dd3263df56d..6c41fa13e36 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -886,6 +886,10 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log) err_vq: for (; i >= 0; --i) { idx = dev->vhost_ops->vhost_get_vq_index(dev, dev->vq_index + i); + addr = virtio_queue_get_desc_addr(dev->vdev, idx); + if (!addr) { + continue; + } vhost_virtqueue_set_addr(dev, dev->vqs + i, idx, dev->log_enabled); }