[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 10/24] qdev: Do not let the user try to device_add
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL v2 10/24] qdev: Do not let the user try to device_add when it cannot work |
Date: |
Tue, 24 Dec 2013 18:04:21 +0100 |
From: Markus Armbruster <address@hidden>
Such devices have always been unavailable and omitted from the list of
available devices shown by device_add help. Until commit 18b6dad
silently broke the former, setting up nasty traps for unwary users,
like this one:
$ qemu-system-x86_64 -nodefaults -monitor stdio -display none
QEMU 1.6.50 monitor - type 'help' for more information
(qemu) device_add apic
Segmentation fault (core dumped)
I call that a regression. Fix it.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
qdev-monitor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/qdev-monitor.c b/qdev-monitor.c
index f2a5a6f..7877d01 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -490,6 +490,11 @@ DeviceState *qdev_device_add(QemuOpts *opts)
}
dc = DEVICE_CLASS(oc);
+ if (dc->cannot_instantiate_with_device_add_yet) {
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver",
+ "pluggable device type");
+ return NULL;
+ }
/* find bus */
path = qemu_opt_get(opts, "bus");
--
1.8.4
- [Qemu-devel] [PULL v2 14/24] qom: Split out object and class caches, (continued)
- [Qemu-devel] [PULL v2 14/24] qom: Split out object and class caches, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 05/24] pci-host: Consistently set cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 02/24] sysbus: Set cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 01/24] qdev: Replace no_user by cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 08/24] vt82c686: Clean up use of cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 07/24] piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 11/24] qdev-monitor: Avoid device_add crashing on non-device driver name, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 12/24] hw: cannot_instantiate_with_device_add_yet due to pointer props, Andreas Färber, 2013/12/24
- [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
- [Qemu-devel] [PULL v2 09/24] isa: Clean up use of cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 10/24] qdev: Do not let the user try to device_add when it cannot work,
Andreas Färber <=
- [Qemu-devel] [PULL v2 13/24] qdev: Document that pointer properties kill device_add, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 16/24] tests: Test QOM interface casting, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 17/24] qom: Detect bad reentrance during object_class_foreach(), Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 18/24] qdev: Drop misleading qbus_free() function, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 21/24] icc_bus: QOM'ify ICC, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 20/24] apic: QOM'ify APIC, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 19/24] apic: Cleanup for QOM'ification, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 22/24] ioapic: Cleanup for QOM'ification, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 23/24] ioapic: QOM'ify ioapic, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 24/24] qdev-monitor: Improve error message for -device nonexistant, Andreas Färber, 2013/12/24