diff options
author | Kevin Wolf <kwolf@redhat.com> | 2014-03-06 16:34:46 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-03-06 17:29:24 +0100 |
commit | eb909c7f72362e3c891d679f6f4eab0885fdb1c1 (patch) | |
tree | f32b78571caebee7014ea77d5714ca57ab722060 /tests/qemu-iotests/051 | |
parent | c75203c8d343dc71d95144862bbb47290689c455 (diff) |
block: Fix error path segfault in bdrv_open()
Using an invalid option for a block device that is opened with
BDRV_O_PROTOCOL led to drv = NULL, and when trying to include the driver
name in the error message, qemu dereferenced it:
$ x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/test.qcow2,file.foo=bar
Segmentation fault (core dumped)
With this patch applied, the expected error message is printed:
$ x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/test.qcow2,file.foo=bar
qemu-system-x86_64: -drive file=/tmp/test.qcow2,file.foo=bar: could
not open disk image /tmp/test.qcow2: Block protocol 'file' doesn't
support the option 'foo'
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Diffstat (limited to 'tests/qemu-iotests/051')
-rwxr-xr-x | tests/qemu-iotests/051 | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 index 46345fb155..14694e176b 100755 --- a/tests/qemu-iotests/051 +++ b/tests/qemu-iotests/051 @@ -78,6 +78,15 @@ run_qemu -drive file="$TEST_IMG",format=qcow2,unknown_opt=1234 run_qemu -drive file="$TEST_IMG",format=qcow2,unknown_opt=foo echo +echo === Unknown protocol option === +echo + +run_qemu -drive file="$TEST_IMG",format=qcow2,file.unknown_opt= +run_qemu -drive file="$TEST_IMG",format=qcow2,file.unknown_opt=on +run_qemu -drive file="$TEST_IMG",format=qcow2,file.unknown_opt=1234 +run_qemu -drive file="$TEST_IMG",format=qcow2,file.unknown_opt=foo + +echo echo === Invalid format === echo |