« Previous | Next » 

Revision d2e4d08b

IDd2e4d08b3e02deb2d5824b17283c63c1354b7696

Added by Luiz Capitulino almost 13 years ago

virtio-serial: Fix segfault on guest boot

If I start qemu with:

  1. qemu -hda disks/test.img -enable-kvm -m 1G -snapshot \
    -device virtio-serial \
    -chardev socket,host=localhost,port=1234,server,nowait,id=foo \
    -device virtserialport,chardev=foo,name=org.qemu.guest_agent

I get a segfault when booting a Fedora 14 guest. The backtrace says:

Program terminated with signal 11, Segmentation fault.
#0 0x0000000000420850 in handle_control_message (vser=0x3732bd0, buf=0x2c173e0, len=8) at /home/lcapitulino/src/qmp-unstable/hw/virtio-serial-bus.c:335
335 info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info);

What's happening is VIRTIO_CONSOLE_DEVICE_READY is a message for the
whole device, not for an individual port. So port is NULL. This bug was
introduced by commit a15bb0d6a981de749452a5180fc8084d625671da.

This commit fixes that by making the port returned by find_port_by_id()
be used only by the VIRTIO_CONSOLE_PORT_READY and
VIRTIO_CONSOLE_PORT_OPEN messages.

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Amit Shah <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences