22c213
From 901e65fa6ccbadeacd6c585cf49a0a7cdafb4737 Mon Sep 17 00:00:00 2001
22c213
From: Julia Suvorova <jusual@redhat.com>
22c213
Date: Wed, 19 Feb 2020 21:34:29 +0000
22c213
Subject: [PATCH 5/7] virtio: make virtio_delete_queue idempotent
22c213
22c213
RH-Author: Julia Suvorova <jusual@redhat.com>
22c213
Message-id: <20200219213431.11913-3-jusual@redhat.com>
22c213
Patchwork-id: 93981
22c213
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 2/4] virtio: make virtio_delete_queue idempotent
22c213
Bugzilla: 1791590
22c213
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
22c213
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
22c213
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
22c213
22c213
From: "Michael S. Tsirkin" <mst@redhat.com>
22c213
22c213
Let's make sure calling this twice is harmless -
22c213
no known instances, but seems safer.
22c213
22c213
Suggested-by: Pan Nengyuan <pannengyuan@huawei.com>
22c213
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
22c213
(cherry picked from commit 8cd353ea0fbf0e334e015d833f612799be642296)
22c213
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
22c213
---
22c213
 hw/virtio/virtio.c | 1 +
22c213
 1 file changed, 1 insertion(+)
22c213
22c213
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
22c213
index d63a369..e6a9ba4 100644
22c213
--- a/hw/virtio/virtio.c
22c213
+++ b/hw/virtio/virtio.c
22c213
@@ -2342,6 +2342,7 @@ void virtio_delete_queue(VirtQueue *vq)
22c213
     vq->handle_output = NULL;
22c213
     vq->handle_aio_output = NULL;
22c213
     g_free(vq->used_elems);
22c213
+    vq->used_elems = NULL;
22c213
 }
22c213
 
22c213
 void virtio_del_queue(VirtIODevice *vdev, int n)
22c213
-- 
22c213
1.8.3.1
22c213