|
|
4636b8 |
From c17dffff03c6ba03633b8e009599bd3863c638fa Mon Sep 17 00:00:00 2001
|
|
|
4636b8 |
From: Julia Suvorova <jusual@redhat.com>
|
|
|
4636b8 |
Date: Wed, 4 Mar 2020 20:07:51 -0500
|
|
|
4636b8 |
Subject: [PATCH 09/12] clean up callback when del virtqueue
|
|
|
4636b8 |
|
|
|
4636b8 |
RH-Author: Julia Suvorova <jusual@redhat.com>
|
|
|
4636b8 |
Message-id: <20200304200754.32708-2-jusual@redhat.com>
|
|
|
4636b8 |
Patchwork-id: 94152
|
|
|
4636b8 |
O-Subject: [RHEL-7.9 qemu-kvm-rhev PATCH 1/4] clean up callback when del virtqueue
|
|
|
4636b8 |
Bugzilla: 1721403
|
|
|
4636b8 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
4636b8 |
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
4636b8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
4636b8 |
|
|
|
4636b8 |
From: liujunjie <liujunjie23@huawei.com>
|
|
|
4636b8 |
|
|
|
4636b8 |
Before, we did not clear callback like handle_output when delete
|
|
|
4636b8 |
the virtqueue which may result be segmentfault.
|
|
|
4636b8 |
The scene is as follows:
|
|
|
4636b8 |
1. Start a vm with multiqueue vhost-net,
|
|
|
4636b8 |
2. then we write VIRTIO_PCI_GUEST_FEATURES in PCI configuration to
|
|
|
4636b8 |
triger multiqueue disable in this vm which will delete the virtqueue.
|
|
|
4636b8 |
In this step, the tx_bh is deleted but the callback virtio_net_handle_tx_bh
|
|
|
4636b8 |
still exist.
|
|
|
4636b8 |
3. Finally, we write VIRTIO_PCI_QUEUE_NOTIFY in PCI configuration to
|
|
|
4636b8 |
notify the deleted virtqueue. In this way, virtio_net_handle_tx_bh
|
|
|
4636b8 |
will be called and qemu will be crashed.
|
|
|
4636b8 |
|
|
|
4636b8 |
Although the way described above is uncommon, we had better reinforce it.
|
|
|
4636b8 |
|
|
|
4636b8 |
CC: qemu-stable@nongnu.org
|
|
|
4636b8 |
Signed-off-by: liujunjie <liujunjie23@huawei.com>
|
|
|
4636b8 |
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
4636b8 |
(cherry picked from commit 7da2d99fb9fbf30104125c061caaff330e362d74)
|
|
|
4636b8 |
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
|
|
|
4636b8 |
---
|
|
|
4636b8 |
hw/virtio/virtio.c | 2 ++
|
|
|
4636b8 |
1 file changed, 2 insertions(+)
|
|
|
4636b8 |
|
|
|
4636b8 |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
|
4636b8 |
index 08a4332210..d228b9297d 100644
|
|
|
4636b8 |
--- a/hw/virtio/virtio.c
|
|
|
4636b8 |
+++ b/hw/virtio/virtio.c
|
|
|
4636b8 |
@@ -1610,6 +1610,8 @@ void virtio_del_queue(VirtIODevice *vdev, int n)
|
|
|
4636b8 |
|
|
|
4636b8 |
vdev->vq[n].vring.num = 0;
|
|
|
4636b8 |
vdev->vq[n].vring.num_default = 0;
|
|
|
4636b8 |
+ vdev->vq[n].handle_output = NULL;
|
|
|
4636b8 |
+ vdev->vq[n].handle_aio_output = NULL;
|
|
|
4636b8 |
}
|
|
|
4636b8 |
|
|
|
4636b8 |
static void virtio_set_isr(VirtIODevice *vdev, int value)
|
|
|
4636b8 |
--
|
|
|
4636b8 |
2.18.2
|
|
|
4636b8 |
|