From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VW71m-0006zb-GE for qemu-devel@nongnu.org; Tue, 15 Oct 2013 11:59:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VW71g-0007EK-HO for qemu-devel@nongnu.org; Tue, 15 Oct 2013 11:59:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VW71g-0007EC-9a for qemu-devel@nongnu.org; Tue, 15 Oct 2013 11:59:16 -0400 Date: Tue, 15 Oct 2013 17:59:17 +0200 From: Kevin Wolf Message-ID: <20131015155917.GG3039@dhcp-200-207.str.redhat.com> References: <1381503951-27985-1-git-send-email-kwolf@redhat.com> <1381503951-27985-55-git-send-email-kwolf@redhat.com> <525D6516.3010005@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <525D6516.3010005@weilnetz.de> Subject: Re: [Qemu-devel] [PULL 54/61] blockdev: Remove IF_* check for read-only blockdev_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: qemu-devel@nongnu.org, Anthony Liguori Am 15.10.2013 um 17:53 hat Stefan Weil geschrieben: > Am 11.10.2013 17:05, schrieb Kevin Wolf: > > IF_NONE allows read-only, which makes forbidding it in this place > > for other types pretty much pointless. > > > > Instead, make sure that all devices for which the check would have > > errored out check in their init function that they don't get a read-only > > BlockDriverState. This catches even cases where IF_NONE and -device is > > used. > > > > Signed-off-by: Kevin Wolf > > Reviewed-by: Eric Blake > > --- > > > > This patch breaks current QEMU (SIGSEGV with ARM in several test scenarios): > > $ git bisect bad > 4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf is the first bad commit > commit 4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf > Author: Kevin Wolf > Date: Fri Sep 13 15:51:47 2013 +0200 > > blockdev: Remove IF_* check for read-only blockdev_init > [...] > > See the gdb protocol below for more details (Linux x86_64 host, default > configuration). > > I got a bug report from a Windows user, but the crash is not OS specific. Does this fix the segfault? diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7380f06..4502ad1 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -494,7 +494,7 @@ SDState *sd_init(BlockDriverState *bs, bool is_spi) { SDState *sd; - if (bdrv_is_read_only(bs)) { + if (bs && bdrv_is_read_only(bs)) { fprintf(stderr, "sd_init: Cannot use read-only drive\n"); return NULL; }