public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] qemu: fix hot remove assigned device
@ 2009-06-08 17:17 Weidong Han
  2009-06-08 14:38 ` Paul Brook
  0 siblings, 1 reply; 11+ messages in thread
From: Weidong Han @ 2009-06-08 17:17 UTC (permalink / raw)
  To: avi, paul; +Cc: kvm, Weidong Han

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@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-06-10  8:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 17:17 [PATCH RFC] qemu: fix hot remove assigned device Weidong Han
2009-06-08 14:38 ` Paul Brook
2009-06-09  2:45   ` Han, Weidong
2009-06-09 14:51     ` Paul Brook
2009-06-09 15:37       ` Gerd Hoffmann
2009-06-10  7:45         ` Han, Weidong
2009-06-10  8:06           ` Avi Kivity
2009-06-10  8:31             ` Han, Weidong
2009-06-10  8:42               ` Avi Kivity
2009-06-10  8:49               ` Gerd Hoffmann
2009-06-10  8:55                 ` Han, Weidong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox