[PATCH RFC] qemu: fix hot remove assigned device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When hot remove an assigned device, segmentation fault was triggered
by qemu_free(&pci_dev->qdev) in pci_unregister_device().
pci_register_device() doesn't initialize or set pci_dev->qdev. For an
assigned device, qdev variable isn't touched at all. So segmentation
fault happens when to free a non-initialized qdev.

Paul,
you introduced the code to free qdev in pci_unregiser_device. Did you
miss something?

Following patch changes the code back to free pci_dev, and fixes the
hot remove issue.

Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx>
---
 hw/pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 25581a4..77d63d8 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -377,7 +377,7 @@ int pci_unregister_device(PCIDevice *pci_dev)
     qemu_free_irqs(pci_dev->irq);
     pci_irq_index--;
     pci_dev->bus->devices[pci_dev->devfn] = NULL;
-    qdev_free(&pci_dev->qdev);
+    qemu_free(pci_dev);
     return 0;
 }
 
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux