qemu/vhost-also-check-queue-state-in-the-vhost_dev_set_lo.patch
zhangxinhao a2786109b9 Backport upstream bugfix
Signed-off-by: zhangxinhao <zhangxinhao1@huawei.com>
2022-09-30 16:47:15 +08:00

40 lines
1.4 KiB
Diff

From cb16f58f6db98113f9079b27e7e313c91060e6e4 Mon Sep 17 00:00:00 2001
From: Ni Xun <richardni@tencent.com>
Date: Thu, 9 Jun 2022 21:10:12 +0800
Subject: [PATCH 3/5] 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>
Signed-off-by: zhangxinhao <zhangxinhao1@huawei.com>
---
hw/virtio/vhost.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 4c4072951c..3ac6cfde03 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -900,6 +900,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);
}
--
2.27.0