diff options
author | Amos Kong <akong@redhat.com> | 2014-04-16 09:57:14 +0800 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2014-07-20 22:14:21 -0500 |
commit | 837e02ef07179876ca2ada2ed67d3eeaa9d3a9d7 (patch) | |
tree | d45a782ba1dc8f652c7761564c4e581d49ae92a0 | |
parent | 46a1b0e489cdb604da81ebde985c35ff798601dc (diff) | |
download | qemu-837e02ef07179876ca2ada2ed67d3eeaa9d3a9d7.zip qemu-837e02ef07179876ca2ada2ed67d3eeaa9d3a9d7.tar.gz qemu-837e02ef07179876ca2ada2ed67d3eeaa9d3a9d7.tar.bz2 |
qdev: Fix crash by validating the object type
QEMU crashed when I try to list device parameters and the driver name is
actually an available bus name.
# qemu -device virtio-pci-bus,?
# qemu -device virtio-bus,?
# qemu -device virtio-serial-bus,?
qdev-monitor.c:212:qdev_device_help: Object 0x7fd932f50620 is not an
instance of type device
Aborted (core dumped)
We can also reproduce this bug by adding device from monitor, so it's
worth to fix the crash.
(qemu) device_add virtio-serial-bus
qdev-monitor.c:491:qdev_device_add: Object 0x7f5e89530920 is not an
instance of type device
Aborted (core dumped)
Cc: qemu-stable@nongnu.org
Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit ce0abca3e35a9f95e9edcb5d6b2910b2fcd52099)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | qdev-monitor.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c index 9268c87..40c117d 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -206,7 +206,7 @@ int qdev_device_help(QemuOpts *opts) } } - if (!klass) { + if (!object_class_dynamic_cast(klass, TYPE_DEVICE)) { return 0; } do { |