From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ3aZ-00085F-56 for qemu-devel@nongnu.org; Tue, 21 Jun 2011 12:14:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZ3aX-0007NN-OK for qemu-devel@nongnu.org; Tue, 21 Jun 2011 12:14:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ3aX-0007NH-Ch for qemu-devel@nongnu.org; Tue, 21 Jun 2011 12:14:05 -0400 From: Markus Armbruster References: <20110617155808.0f080bfc@doriath> Date: Tue, 21 Jun 2011 18:13:45 +0200 In-Reply-To: <20110617155808.0f080bfc@doriath> (Luiz Capitulino's message of "Fri, 17 Jun 2011 15:58:08 -0300") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2] virtio-serial: Fix segfault on guest boot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: amit.shah@redhat.com, qemu-devel , mdroth@linux.vnet.ibm.com Luiz Capitulino writes: > If I start qemu with: > > # 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. Reviewed-by: Markus Armbruster