qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 54/61] blockdev: Remove IF_* check for read-only


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PULL 54/61] blockdev: Remove IF_* check for read-only blockdev_init
Date: Tue, 15 Oct 2013 17:59:17 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> > Reviewed-by: Eric Blake <address@hidden>
> > ---
> >
> 
> 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 <address@hidden>
> 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;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]