From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MERrv-0006Ek-B8 for qemu-devel@nongnu.org; Wed, 10 Jun 2009 13:45:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MERrq-0006D6-Ii for qemu-devel@nongnu.org; Wed, 10 Jun 2009 13:45:46 -0400 Received: from [199.232.76.173] (port=42108 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MERrq-0006D2-Dk for qemu-devel@nongnu.org; Wed, 10 Jun 2009 13:45:42 -0400 Received: from mx2.redhat.com ([66.187.237.31]:34899) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MERrp-0002vd-7p for qemu-devel@nongnu.org; Wed, 10 Jun 2009 13:45:42 -0400 From: Markus Armbruster Date: Wed, 10 Jun 2009 19:43:29 +0200 Message-ID: <87bpowhtmm.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Monitor command pci_add regressed (qdev) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, paul@codesourcery.com gdb --args qemu -monitor stdio tmp.qcow2 -S [...] QEMU 0.10.50 monitor - type 'help' for more information (qemu) pci_add pci_addr=auto storage if=virtio,file=foo.img Program received signal SIGSEGV, Segmentation fault. 0x080630c5 in virtio_blk_init (dev=0x849a008) at /home/armbru/work/qemu/hw/virtio-blk.c:368 368 bs->private = dev; This used to work just fine. Culprit seems to be commit 07e3af9a. qdev_init_bdrv() fails, and virtio_blk_init() doesn't check the failure. I haven't investigated why qdev_init_bdrv() fails (the old code got the BlockDriverState just fine). Regardless, there are scenarios where qdev_init_bdrv() rightly fails, so virtio_blk_init() needs fixing. Returning NULL would be easy enough, but its caller virtio_blk_init_pci() doesn't check its value, and it is a qdev init() callback, which can't fail. How to handle the error? exit(1) would be just fine for -drive, but not for a monitor command.