qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-1.5] qdev: skip bus check for bus-less devices in qdev_unplug()
@ 2013-05-03 13:25 Igor Mammedov
  2013-05-03 18:59 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Mammedov @ 2013-05-03 13:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, bonzini, afaerber

Since commit 2f7bd829db "qdev: Fix device_add bus assumptions"
it's possible to device_add bus-less device, but if such device is
unplugged it will dereference NULL parent_bus in qdev_unplug().

Fix it by taking in account that parent_bus might be NULL and
skipping bus check.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/core/qdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index ab1d8f5..069ac90 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -208,7 +208,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
 {
     DeviceClass *dc = DEVICE_GET_CLASS(dev);
 
-    if (!dev->parent_bus->allow_hotplug) {
+    if (dev->parent_bus && !dev->parent_bus->allow_hotplug) {
         error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
         return;
     }
-- 
1.8.2.1

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

* Re: [Qemu-devel] [PATCH for-1.5] qdev: skip bus check for bus-less devices in qdev_unplug()
  2013-05-03 13:25 [Qemu-devel] [PATCH for-1.5] qdev: skip bus check for bus-less devices in qdev_unplug() Igor Mammedov
@ 2013-05-03 18:59 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2013-05-03 18:59 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: aliguori, bonzini, afaerber

Applied.  Thanks.

Regards,

Anthony Liguori

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

end of thread, other threads:[~2013-05-03 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-03 13:25 [Qemu-devel] [PATCH for-1.5] qdev: skip bus check for bus-less devices in qdev_unplug() Igor Mammedov
2013-05-03 18:59 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).