summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2013-11-28 17:02:24 +0100
committerMichael Roth <mdroth@linux.vnet.ibm.com>2014-02-20 21:59:18 -0600
commit29b0fcc181341bf1308a7c7645401815d5834232 (patch)
tree2862e2de26a2dc9b58b4c94e348a37e234ea217a
parentb8fca09eecd364e79f29294aa5366718ffc9469a (diff)
downloadqemu-29b0fcc181341bf1308a7c7645401815d5834232.tar.gz
qdev-monitor: Avoid device_add crashing on non-device driver name
Watch this: $ upstream-qemu -nodefaults -S -display none -monitor stdio QEMU 1.7.50 monitor - type 'help' for more information (qemu) device_add rng-egd /work/armbru/qemu/qdev-monitor.c:491:qdev_device_add: Object 0x2089b00 is not an instance of type device Aborted (core dumped) Crashes because "rng-egd" exists, but isn't a subtype of TYPE_DEVICE. Broken in commit 18b6dad. Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> (cherry picked from commit 061e84f7a469ad1f94f3b5f6a5361b346ab990e8) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--qdev-monitor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c
index dc37a43dd9..90a0cea308 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -477,7 +477,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
}
}
- if (!oc) {
+ if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type");
return NULL;
}