From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PULL 09/10] qdev: fix -device scsi-hd, help regression
Date: Thu, 10 Jan 2019 12:29:54 -0200 [thread overview]
Message-ID: <20190110142955.23254-10-ehabkost@redhat.com> (raw)
In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Since commit ea9ce8934, device_post_init() applies globals directly
from machines and accelerator classes.
There are cases, such as -device scsi-hd,help, where the machine is
setup but there in no accelerator.
Let's skip accelerator globals in this case.
Fixes SEGV:
#0 0x0000555558ea04ff in object_get_class (obj=0x0) at /home/elmarco/src/qemu/build/../qom/object.c:857
#1 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:978
#2 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:973
#3 0x000055555854c959 in device_post_init (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:989
#4 0x0000555558e9e250 in object_post_init_with_type (ti=<optimized out>, obj=0x616000078980) at /home/elmarco/src/qemu/build/../qom/object.c:365
#5 0x0000555558e9e250 in object_initialize_with_type (data=0x616000078980, size=616, type=<optimized out>) at /home/elmarco/src/qemu/build/../qom/object.c:425
#6 0x0000555558e9e571 in object_new_with_type (type=0x613000031900) at /home/elmarco/src/qemu/build/../qom/object.c:588
#7 0x000055555830c048 in qmp_device_list_properties (typename=typename@entry=0x60200000c2d0 "scsi-hd", errp=errp@entry=0x7fffffffc540) at /home/elmarco/src/qemu/qmp.c:519
#8 0x00005555582c4027 in qdev_device_help (opts=<optimized out>) at /home/elmarco/src/qemu/qdev-monitor.c:283
#9 0x0000555559378fa2 in qemu_opts_foreach (list=<optimized out>, func=func@entry=0x5555582cfca0 <device_help_func>, opaque=opaque@entry=0x0, errp=errp@entry=0x0) at /home/elmarco/src/qemu/util/qemu-option.c:1171
https://bugzilla.redhat.com/show_bug.cgi?id=1664364
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190109102311.7635-1-marcandre.lureau@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Lukáš Doktor <ldoktor@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/core/qdev.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 3769a2bccb..47bddacb4f 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -975,10 +975,13 @@ void object_apply_compat_props(Object *obj)
if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
MachineState *m = MACHINE(qdev_get_machine());
MachineClass *mc = MACHINE_GET_CLASS(m);
- AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
- if (ac->compat_props) {
- object_apply_global_props(obj, ac->compat_props, &error_abort);
+ if (m->accelerator) {
+ AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
+
+ if (ac->compat_props) {
+ object_apply_global_props(obj, ac->compat_props, &error_abort);
+ }
}
object_apply_global_props(obj, mc->compat_props, &error_abort);
}
--
2.18.0.rc1.1.g3f1ff2140
next prev parent reply other threads:[~2019-01-10 14:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 14:29 [Qemu-devel] [PULL 00/10] Machine queue, 2019-01-10 Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 01/10] qemu-deprecated.texi: Rename the HMP section Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 02/10] Update that HMP 'cpu-add' is deprecated in 4.0 Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 03/10] Mention that QMP 'cpu-add' will be deprecated Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 04/10] range: add some more functions Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 05/10] memory-device: rewrite address assignment using ranges Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 06/10] spapr: Eliminate SPAPR_PCI_2_7_MMIO_WIN_SIZE macro Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 07/10] machine: Eliminate unnecessary stringify() usage Eduardo Habkost
2019-01-10 14:29 ` [Qemu-devel] [PULL 08/10] machine: Use shorter format for GlobalProperty arrays Eduardo Habkost
2019-01-10 14:29 ` Eduardo Habkost [this message]
2019-01-10 14:29 ` [Qemu-devel] [PULL 10/10] qom: Don't keep error value between object_property_parse() calls Eduardo Habkost
2019-01-11 15:45 ` [Qemu-devel] [PULL 00/10] Machine queue, 2019-01-10 Peter Maydell
2019-01-11 22:42 ` no-reply
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=20190110142955.23254-10-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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).