aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2019-12-09 11:47:24 -0500
committerMichael Roth <mdroth@linux.vnet.ibm.com>2020-05-12 09:27:04 -0500
commita843731d7f09ca102833a06adaf358abb524a86b (patch)
tree858b0dd9658a280e2c9fbd7bb2bf47de660053aa /hw/virtio/virtio.c
parentd5a5d43e27308df63f4c7be4ec988c969ac45d1d (diff)
virtio: make virtio_delete_queue idempotent
Let's make sure calling this twice is harmless - no known instances, but seems safer. Suggested-by: Pan Nengyuan <pannengyuan@huawei.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 8cd353ea0fbf0e334e015d833f612799be642296) *prereq for 421afd2fe8 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw/virtio/virtio.c')
-rw-r--r--hw/virtio/virtio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 31dd140990..6de3cfdc2c 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2337,6 +2337,7 @@ void virtio_delete_queue(VirtQueue *vq)
vq->handle_output = NULL;
vq->handle_aio_output = NULL;
g_free(vq->used_elems);
+ vq->used_elems = NULL;
}
void virtio_del_queue(VirtIODevice *vdev, int n)