diff options
author | Ni Xun <richardni@tencent.com> | 2022-06-09 21:10:12 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-06-16 12:54:58 -0400 |
commit | 9ce305c8beb9ba7edacd0585139cce56a195c1da (patch) | |
tree | 93c8c052586da48dba4827a914072eb30a7a745d /hw/virtio | |
parent | 0e660a6f90abf8b517d7317595bcc8e8da31f2a1 (diff) | |
download | qemu-9ce305c8beb9ba7edacd0585139cce56a195c1da.zip qemu-9ce305c8beb9ba7edacd0585139cce56a195c1da.tar.gz qemu-9ce305c8beb9ba7edacd0585139cce56a195c1da.tar.bz2 |
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 <richardni@tencent.com>
Reviewed-by: Zhigang Lu <tonnylu@tencent.com>
Message-Id: <OS0PR01MB57139163F3F3955960675B52EAA79@OS0PR01MB5713.jpnprd01.prod.outlook.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index dd3263d..6c41fa1 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); } |