diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-08-19 06:51:04 +0530 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-08-22 16:19:00 -0500 |
commit | 8b53a865772789a3402a44aa80169f8dd728eba2 (patch) | |
tree | 8b631a97e84bff356a61a2664faff2f92501b577 /hw/virtio-pci.c | |
parent | 583cd3cb93649ef223e36bf33197de65c3d9767b (diff) | |
download | qemu-8b53a865772789a3402a44aa80169f8dd728eba2.zip qemu-8b53a865772789a3402a44aa80169f8dd728eba2.tar.gz qemu-8b53a865772789a3402a44aa80169f8dd728eba2.tar.bz2 |
virtio-serial: Cleanup on device hot-unplug
Free malloc'ed memory, unregister from savevm and clean up virtio-common
bits on device hot-unplug.
This was found performing a migration after device hot-unplug.
Reported-by: <lihuang@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r-- | hw/virtio-pci.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 17c3d15..82a6d78 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -599,6 +599,14 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev) return 0; } +static int virtio_serial_exit_pci(PCIDevice *pci_dev) +{ + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); + + virtio_serial_exit(proxy->vdev); + return virtio_exit_pci(pci_dev); +} + static int virtio_net_init_pci(PCIDevice *pci_dev) { VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); @@ -689,7 +697,7 @@ static PCIDeviceInfo virtio_info[] = { .qdev.alias = "virtio-serial", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_serial_init_pci, - .exit = virtio_exit_pci, + .exit = virtio_serial_exit_pci, .qdev.props = (Property[]) { DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, DEV_NVECTORS_UNSPECIFIED), |