|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [qemu-upstream-unstable] qdev: Avoid type assertion in qdev_build_hotpluggable_device_list()
commit 4ec1b9b159b79cf391753ef19aeff2236a6c099c
Author: Jun Li <junmuzi@xxxxxxxxx>
AuthorDate: Wed Nov 5 15:03:03 2014 +0800
Commit: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Sun Mar 8 22:58:13 2015 -0500
qdev: Avoid type assertion in qdev_build_hotpluggable_device_list()
Currently when *obj is not a TYPE_DEVICE, QEMU will abort. This patch
fixes it. When *obj is not a TYPE_DEVICE, just do not add it to hotpluggable
device list.
This patch also fixes the following issue:
1. boot QEMU using cli:
$ /opt/qemu-git-arm/bin/qemu-system-x86_64 -monitor stdio -enable-kvm \
-device virtio-scsi-pci,id=scsi0
2. device_del scsi0 via hmp using tab key(first input device_del, then press
"Tab" key).
(qemu) device_del
After step 2, QEMU will abort.
(qemu) device_del hw/core/qdev.c:930:qdev_build_hotpluggable_device_list:
Object 0x5555563a2460 is not an instance of type device
Signed-off-by: Jun Li <junmuzi@xxxxxxxxx>
Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: qemu-stable@xxxxxxxxxx
Signed-off-by: Andreas Färber <afaerber@xxxxxxx>
(cherry picked from commit 09d560177101d2ef1e333754a25cfa49b70583b3)
Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
hw/core/qdev.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 35fd00d..ef06aa4 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -938,7 +938,12 @@ void qdev_alias_all_properties(DeviceState *target, Object
*source)
static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
{
GSList **list = opaque;
- DeviceState *dev = DEVICE(obj);
+ DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
+ TYPE_DEVICE);
+
+ if (dev == NULL) {
+ return 0;
+ }
if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
*list = g_slist_append(*list, dev);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git
_______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |