diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-08-14 23:33:30 +0400 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2023-09-11 10:53:51 +0300 |
commit | 3c99de0aa7f3cbb22b002320202bf75226085536 (patch) | |
tree | 802a57accb77dca1bfda22578d3fe92f5c27c74f /hw | |
parent | ebac7b1bef9cd2f3ad2fbf4a412c8123689dfde7 (diff) |
qxl: don't assert() if device isn't yet initialized
If the PCI BAR isn't yet mapped or was unmapped, QXL_IO_SET_MODE will
assert(). Instead, report a guest bug and keep going.
This can be reproduced with:
cat << EOF | ./qemu-system-x86_64 -vga qxl -m 2048 -nodefaults -qtest stdio
outl 0xcf8 0x8000101c
outl 0xcfc 0xc000
outl 0xcf8 0x80001001
outl 0xcfc 0x01000000
outl 0xc006 0x00
EOF
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1829
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 95bef686e490bc3afc3f51f5fc6e20bf260b938c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/display/qxl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 67efa3c3ef..6b38e55a21 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -1613,7 +1613,10 @@ static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm) } d->guest_slots[0].slot = slot; - assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0); + if (qxl_add_memslot(d, 0, devmem, QXL_SYNC) != 0) { + qxl_set_guest_bug(d, "device isn't initialized yet"); + return; + } d->guest_primary.surface = surface; qxl_create_guest_primary(d, 0, QXL_SYNC); |