From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
qemu-stable@nongnu.org
Subject: [Qemu-devel] [PULL v2 11/24] qdev-monitor: Avoid device_add crashing on non-device driver name
Date: Tue, 24 Dec 2013 18:04:22 +0100 [thread overview]
Message-ID: <1387904675-7962-12-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1387904675-7962-1-git-send-email-afaerber@suse.de>
From: Markus Armbruster <armbru@redhat.com>
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>
---
qdev-monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 7877d01..177b849 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -478,7 +478,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;
}
--
1.8.4
next prev parent reply other threads:[~2013-12-24 17:04 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-24 17:04 [Qemu-devel] [PULL v2 00/24] QOM devices patch queue 2013-12-24 Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 01/24] qdev: Replace no_user by cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 19:43 ` Michael S. Tsirkin
2014-01-07 10:28 ` Markus Armbruster
2014-01-07 11:56 ` Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 02/24] sysbus: Set cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 03/24] cpu: Document why cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 04/24] apic: " Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 05/24] pci-host: Consistently set cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 06/24] ich9: Document why cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 07/24] piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 08/24] vt82c686: " Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 09/24] isa: " Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 10/24] qdev: Do not let the user try to device_add when it cannot work Andreas Färber
2013-12-24 17:04 ` Andreas Färber [this message]
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 12/24] hw: cannot_instantiate_with_device_add_yet due to pointer props Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 13/24] qdev: Document that pointer properties kill device_add Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 14/24] qom: Split out object and class caches Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 15/24] qom: Do not register interface "types" in the type table and fix names Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 16/24] tests: Test QOM interface casting Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 17/24] qom: Detect bad reentrance during object_class_foreach() Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 18/24] qdev: Drop misleading qbus_free() function Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 19/24] apic: Cleanup for QOM'ification Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 20/24] apic: QOM'ify APIC Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 21/24] icc_bus: QOM'ify ICC Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 22/24] ioapic: Cleanup for QOM'ification Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 23/24] ioapic: QOM'ify ioapic Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 24/24] qdev-monitor: Improve error message for -device nonexistant Andreas Färber
2014-02-04 15:56 ` [Qemu-devel] [PULL v2 00/24] QOM devices patch queue 2013-12-24 Andreas Färber
2014-02-04 16:13 ` Michael S. Tsirkin
2014-02-04 17:40 ` Michael S. Tsirkin
2014-02-04 18:07 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387904675-7962-12-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).