[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: |
Stefan Weil |
Subject: |
Re: [Qemu-devel] [PULL 54/61] blockdev: Remove IF_* check for read-only blockdev_init |
Date: |
Tue, 15 Oct 2013 18:02:46 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
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 <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;
> }
Yes.
- [Qemu-devel] [PULL 46/61] blockdev: Separate ID generation from DriveInfo creation, (continued)
- [Qemu-devel] [PULL 46/61] blockdev: Separate ID generation from DriveInfo creation, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 48/61] blockdev: Move parsing of 'media' option to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 49/61] blockdev: Move parsing of 'if' option to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 50/61] blockdev: Moving parsing of geometry options to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 51/61] blockdev: Move parsing of 'boot' option to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 52/61] blockdev: Move bus/unit/index processing to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 53/61] blockdev: Move virtio-blk device creation to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 54/61] blockdev: Remove IF_* check for read-only blockdev_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 55/61] qemu-iotests: Check autodel behaviour for device_del, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 57/61] blockdev: Don't disable COR automatically with blockdev-add, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 56/61] blockdev: Remove 'media' parameter from blockdev_init(), Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 59/61] vmdk: Fix vmdk_parse_extents, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 61/61] qemu-iotests: Add test for inactive L2 overlap, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 60/61] qemu-io: Let "open" pass options to block driver, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 58/61] blockdev: blockdev_init() error conversion, Kevin Wolf, 2013/10/11