summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Qiang2020-08-13 18:51:25 +0200
committerMichael S. Tsirkin2020-09-29 09:06:12 +0200
commit2bc9e0da573f77b2f21cc6e4a681c31ddeccfd1d (patch)
treec9ae59bc4e68d79f316365359991fb5819d492d6
parenttests/acpi: update golden master DSDT binary table blobs for q35 (diff)
downloadqemu-2bc9e0da573f77b2f21cc6e4a681c31ddeccfd1d.tar.gz
qemu-2bc9e0da573f77b2f21cc6e4a681c31ddeccfd1d.tar.xz
qemu-2bc9e0da573f77b2f21cc6e4a681c31ddeccfd1d.zip
hw: virtio-pmem: detach the element fromt the virtqueue when error occurs
If error occurs while processing the virtio request we should call 'virtqueue_detach_element' to detach the element from the virtqueue before free the elem. Signed-off-by: Li Qiang <liq3ea@163.com> Message-Id: <20200813165125.59928-1-liq3ea@163.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Fixes: 5f503cd9f3 ("virtio-pmem: add virtio device") Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
-rw-r--r--hw/virtio/virtio-pmem.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
index 1e0c137497..ddb0125901 100644
--- a/hw/virtio/virtio-pmem.c
+++ b/hw/virtio/virtio-pmem.c
@@ -77,6 +77,7 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
if (req_data->elem.out_num < 1 || req_data->elem.in_num < 1) {
virtio_error(vdev, "virtio-pmem request not proper");
+ virtqueue_detach_element(vq, (VirtQueueElement *)req_data, 0);
g_free(req_data);
return;
}