Message ID | 20131015155917.GG3039@dhcp-200-207.str.redhat.com |
---|---|
State | New |
Headers | show |
Am 15.10.2013 17:59, schrieb Kevin Wolf: > 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 <kwolf@redhat.com> >>> Reviewed-by: Eric Blake <eblake@redhat.com> >>> --- >>> >> 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 <kwolf@redhat.com> >> 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; > } Yes.
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; }