[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/15] virtio-iommu: Check gtrees are non null before destroying t
From: |
Michael S. Tsirkin |
Subject: |
[PULL 14/15] virtio-iommu: Check gtrees are non null before destroying them |
Date: |
Fri, 18 Sep 2020 11:06:27 -0400 |
From: Eric Auger <eric.auger@redhat.com>
If realize fails, domains and endpoints trees may be NULL. On
unrealize(), this produces assertions:
"GLib: g_tree_destroy: assertion 'tree != NULL' failed"
Check that the trees are non NULL before destroying them.
Cc: qemu-stable@nongnu.org
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200908193309.20569-2-eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-iommu.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index 5d56865e56..21ec63b108 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -801,8 +801,12 @@ static void virtio_iommu_device_unrealize(DeviceState *dev)
VirtIOIOMMU *s = VIRTIO_IOMMU(dev);
g_hash_table_destroy(s->as_by_busptr);
- g_tree_destroy(s->domains);
- g_tree_destroy(s->endpoints);
+ if (s->domains) {
+ g_tree_destroy(s->domains);
+ }
+ if (s->endpoints) {
+ g_tree_destroy(s->endpoints);
+ }
virtio_delete_queue(s->req_vq);
virtio_delete_queue(s->event_vq);
--
MST
- [PULL 05/15] pc: fix auto_enable_numa_with_memhp/auto_enable_numa_with_memdev for the 5.0 machine, (continued)
- [PULL 05/15] pc: fix auto_enable_numa_with_memhp/auto_enable_numa_with_memdev for the 5.0 machine, Michael S. Tsirkin, 2020/09/18
- [PULL 07/15] vhost: check queue state in the vhost_dev_set_log routine, Michael S. Tsirkin, 2020/09/18
- [PULL 06/15] vhost: recheck dev state in the vhost_migration_log routine, Michael S. Tsirkin, 2020/09/18
- [PULL 08/15] tests/qtest/vhost-user-test: prepare the tests for adding new dev class, Michael S. Tsirkin, 2020/09/18
- [PULL 12/15] tests/qtest/vhost-user-test: enable the reconnect tests, Michael S. Tsirkin, 2020/09/18
- [PULL 15/15] virtio-iommu-pci: force virtio version 1, Michael S. Tsirkin, 2020/09/18
- [PULL 09/15] tests/qtest/libqos/virtio-blk: add support for vhost-user-blk, Michael S. Tsirkin, 2020/09/18
- [PULL 11/15] tests/qtest/vhost-user-test: add migrate_reconnect test, Michael S. Tsirkin, 2020/09/18
- [PULL 13/15] cphp: remove deprecated cpu-add command(s), Michael S. Tsirkin, 2020/09/18
- [PULL 14/15] virtio-iommu: Check gtrees are non null before destroying them,
Michael S. Tsirkin <=
- [PULL 10/15] tests/qtest/vhost-user-test: add support for the vhost-user-blk device, Michael S. Tsirkin, 2020/09/18
- Re: [PULL 00/15] virtio,pc,acpi: fixes, tests, Peter Maydell, 2020/09/18