Skip to content

Commit eeee989

Browse files
elmarcoMichael Tokarev
authored and
Michael Tokarev
committed
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 <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Cc: [email protected] Signed-off-by: Michael Tokarev <[email protected]> (cherry picked from commit 95bef68) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 93d4107 commit eeee989

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hw/display/qxl.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,10 @@ static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm)
15911591
}
15921592

15931593
d->guest_slots[0].slot = slot;
1594-
assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0);
1594+
if (qxl_add_memslot(d, 0, devmem, QXL_SYNC) != 0) {
1595+
qxl_set_guest_bug(d, "device isn't initialized yet");
1596+
return;
1597+
}
15951598

15961599
d->guest_primary.surface = surface;
15971600
qxl_create_guest_primary(d, 0, QXL_SYNC);

0 commit comments

Comments
 (0)