[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/13] ui/console: only walk QemuGraphicConsoles in qemu_console_i
|
From: |
marcandre . lureau |
|
Subject: |
[PULL 03/13] ui/console: only walk QemuGraphicConsoles in qemu_console_is_multihead() |
|
Date: |
Tue, 3 Oct 2023 16:35:32 +0400 |
From: Laszlo Ersek <lersek@redhat.com>
qemu_console_is_multihead() declares the console "c" a "multihead" console
if there are two different consoles in the system that (a) both reference
"c->device", and (b) have different "c->head" numbers. In effect, if at
least two consoles exist that are different heads of the same device that
underlies "c".
Commit 58d5870845c6 ("ui/console: move graphic fields to
QemuGraphicConsole", 2023-09-04) pushed the "device" and "head" members
from the QemuConsole base class down to the QemuGraphicConsole subclass,
adjusting the referring QOM properties accordingly as well. As a result,
the "device" property lookup in qemu_console_is_multihead() now crashes,
in case the candidate console being investigated for criterion (a) is not
a QemuGraphicConsole instance:
> Unexpected error in object_property_find_err() at qom/object.c:1314:
> qemu: Property 'qemu-fixed-text-console.device' not found
> Aborted (core dumped)
This is effectively an unchecked downcast. Make it checked: only consider
such console candidates that are themselves QemuGraphicConsole instances.
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> (odd fixer:Graphics)
Cc: Gerd Hoffmann <kraxel@redhat.com> (odd fixer:Graphics)
Fixes: 58d5870845c6
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20230913144959.41891-3-lersek@redhat.com>
---
ui/console.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ui/console.c b/ui/console.c
index d17b4ee397..4fe26c08fb 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1442,6 +1442,9 @@ static bool qemu_console_is_multihead(DeviceState *dev)
uint32_t h;
QTAILQ_FOREACH(con, &consoles, next) {
+ if (!QEMU_IS_GRAPHIC_CONSOLE(con)) {
+ continue;
+ }
obj = object_property_get_link(OBJECT(con),
"device", &error_abort);
if (DEVICE(obj) != dev) {
--
2.41.0
- [PULL 00/13] Misc patches, marcandre . lureau, 2023/10/03
- [PULL 01/13] input: Allow to choose console with qemu_input_is_absolute, marcandre . lureau, 2023/10/03
- [PULL 02/13] ui/console: make qemu_console_is_multihead() static, marcandre . lureau, 2023/10/03
- [PULL 04/13] ui/console: eliminate QOM properties from qemu_console_is_multihead(), marcandre . lureau, 2023/10/03
- [PULL 03/13] ui/console: only walk QemuGraphicConsoles in qemu_console_is_multihead(),
marcandre . lureau <=
- [PULL 05/13] ui/console: sanitize search in qemu_graphic_console_is_multihead(), marcandre . lureau, 2023/10/03
- [PULL 07/13] win32: avoid discarding the exception handler, marcandre . lureau, 2023/10/03
- [PULL 06/13] ui: add XBGR8888 and ABGR8888 in drm_format_pixman_map, marcandre . lureau, 2023/10/03
- [PULL 08/13] ui/gtk: fix UI info precondition, marcandre . lureau, 2023/10/03
- [PULL 09/13] analyze-migration: ignore RAM_SAVE_FLAG_MULTIFD_FLUSH, marcandre . lureau, 2023/10/03
- [PULL 10/13] hw/core: remove needless includes, marcandre . lureau, 2023/10/03
- [PULL 13/13] chardev/char-pty: Avoid losing bytes when the other side just (re-)connected, marcandre . lureau, 2023/10/03
- [PULL 11/13] hw/pc: remove needless includes, marcandre . lureau, 2023/10/03
- [PULL 12/13] hw/display/ramfb: plug slight guest-triggerable leak on mode setting, marcandre . lureau, 2023/10/03
- Re: [PULL 00/13] Misc patches, Stefan Hajnoczi, 2023/10/05