Skip to content
Snippets Groups Projects
Commit fc0c1285 authored by Maksim Davydov's avatar Maksim Davydov Committed by Marc-André Lureau
Browse files

chardev: fix segfault in finalize


If finalize chardev-msmouse or chardev-wctable is called immediately after
init it cases QEMU to crash with segfault. This happens because of
QTAILQ_REMOVE in qemu_input_handler_unregister tries to dereference
NULL pointer.
For instance, this error can be reproduced via `qom-list-properties`
command.

Signed-off-by: default avatarMaksim Davydov <davydov-max@yandex-team.ru>
Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-Id: <20220825165247.33704-1-davydov-max@yandex-team.ru>
parent 769a726c
No related branches found
No related tags found
No related merge requests found
......@@ -247,7 +247,9 @@ static void char_msmouse_finalize(Object *obj)
{
MouseChardev *mouse = MOUSE_CHARDEV(obj);
qemu_input_handler_unregister(mouse->hs);
if (mouse->hs) {
qemu_input_handler_unregister(mouse->hs);
}
fifo8_destroy(&mouse->outbuf);
}
......
......@@ -319,7 +319,9 @@ static void wctablet_chr_finalize(Object *obj)
{
TabletChardev *tablet = WCTABLET_CHARDEV(obj);
qemu_input_handler_unregister(tablet->hs);
if (tablet->hs) {
qemu_input_handler_unregister(tablet->hs);
}
}
static void wctablet_chr_open(Chardev *chr,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment