diff options
author | wangmeiling <wangmeiling21@huawei.com> | 2023-12-14 07:22:08 +0000 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-12-26 04:51:07 -0500 |
commit | 410cefbd5c3682432229f5905aa43358785d2ae0 (patch) | |
tree | debdd52d2d94226d40cb2945685c632048bdc5a0 | |
parent | 551bf7b4c1795ef89407039dd908c2f199b122c2 (diff) | |
download | qemu-410cefbd5c3682432229f5905aa43358785d2ae0.zip qemu-410cefbd5c3682432229f5905aa43358785d2ae0.tar.gz qemu-410cefbd5c3682432229f5905aa43358785d2ae0.tar.bz2 |
Fix bugs when VM shutdown with virtio-gpu unplugged
Virtio-gpu malloc memory for the queue when it realized, but the queues was not
released when it unrealized, which resulting in a memory leak. In addition,
vm_change_state_handler is not cleaned up, which is related to vdev and will
lead to segmentation fault when VM shutdown.
Signed-off-by: wangmeiling <wangmeiling21@huawei.com>
Signed-off-by: Binfeng Wu <wubinfeng@huawei.com>
Message-Id: <7bbbc0f3-2ad9-83ca-b39b-f976d0837daf@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | hw/display/virtio-gpu-base.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 37af256..4fc7ef8 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -251,7 +251,11 @@ void virtio_gpu_base_device_unrealize(DeviceState *qdev) { VirtIOGPUBase *g = VIRTIO_GPU_BASE(qdev); + VirtIODevice *vdev = VIRTIO_DEVICE(qdev); + virtio_del_queue(vdev, 0); + virtio_del_queue(vdev, 1); + virtio_cleanup(vdev); migrate_del_blocker(&g->migration_blocker); } |