]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commit
qdev: Avoid type assertion in qdev_build_hotpluggable_device_list()
authorJun Li <junmuzi@gmail.com>
Wed, 5 Nov 2014 07:03:03 +0000 (15:03 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 9 Mar 2015 03:58:13 +0000 (22:58 -0500)
commit4ec1b9b159b79cf391753ef19aeff2236a6c099c
tree3bf0b6a8a2399198fc95797c8994bc73c226aab0
parent3e04f97cbc904fc8196774758c76343b3ee9ef6a
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@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 09d560177101d2ef1e333754a25cfa49b70583b3)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/core/qdev.c