This series fixes various issues spotted by Coverity. None of these is critical; most are just "If you do something crazy, qemu-img crashes" or "But what if there is no qcow2 driver?". Therefore, while these are bug fixes, it is a bit late to try to push them into 2.2.0. I am therefore tempted to vote to target 2.3 instead.
Also, none is security-relevant. The only crashes which are fixed here are sure to have resulted from dereferencing a NULL pointer. v2: - Patch 1: There are a couple of block drivers which have to always statically linked into qemu; those are file (because it's the standard protocol), raw (because currently it's the standard format) and qcow2 (because it's the de-facto standard non-raw and backing format). This patch adds public symbols for their BlockDriver objects so they can be used from the block driver without having to resort to bdrv_find_format() (which may fail). [my interpretation of Markus and Kevin] - Patch 2: Replaces patch 1 from v1; use the symbols introduced in patch 1. [again, my interpretation of Markus and Kevin] - Patch 3: No changes; albeit dropping the old patch 1 and introducing the new patch 2 instead, I decided not to rely on qcow at compile-time. qcow has been deprecated, so I can imagine some users not wanting to link qcow into qemu (whatever gain they expect from that). Therefore, although I think it's fine to rely on qcow2 at compile-time, I don't think it fine to rely on qcow as well. - Patch 4: Added a note to the commit message on what concrete case is fixed, and why I don't add an iotest for that case [Kevin] - Patch 11: Fixed the reference output of tests 026, 071 and 089 git-backport-diff against v1: Key: [----] : patches are identical [####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively 001/13:[down] 'block: Make essential BlockDriver objects public' 002/13:[down] 'block: Omit bdrv_find_format for essential drivers' 003/13:[----] [--] 'block/vvfat: qcow driver may not be found' 004/13:[----] [--] 'block/nfs: Add create_opts' 005/13:[----] [--] 'block: Check create_opts before image creation' 006/13:[----] [--] 'qemu-img: Check create_opts before image creation' 007/13:[----] [--] 'qemu-img: Check create_opts before image amendment' 008/13:[----] [--] 'iotests: Only kill NBD server if it runs' 009/13:[----] [-C] 'iotests: Add test for unsupported image creation' 010/13:[----] [--] 'qcow2: Prevent numerical overflow' 011/13:[0130] [FC] 'qcow2: Flushing the caches in qcow2_close may fail' 012/13:[----] [--] 'qcow2: Respect bdrv_truncate() error' 013/13:[----] [--] 'block/raw-posix: Fix ret in raw_open_common()' Max Reitz (13): block: Make essential BlockDriver objects public block: Omit bdrv_find_format for essential drivers block/vvfat: qcow driver may not be found block/nfs: Add create_opts block: Check create_opts before image creation qemu-img: Check create_opts before image creation qemu-img: Check create_opts before image amendment iotests: Only kill NBD server if it runs iotests: Add test for unsupported image creation qcow2: Prevent numerical overflow qcow2: Flushing the caches in qcow2_close may fail qcow2: Respect bdrv_truncate() error block/raw-posix: Fix ret in raw_open_common() block.c | 23 +++++---- block/nfs.c | 15 ++++++ block/qcow2-cluster.c | 2 +- block/qcow2.c | 26 +++++++--- block/raw-posix.c | 5 +- block/raw-win32.c | 4 +- block/raw_bsd.c | 4 +- block/vvfat.c | 6 +++ include/block/block_int.h | 8 +++ qemu-img.c | 21 ++++++++ tests/qemu-iotests/026.out | 120 +++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/071.out | 8 +++ tests/qemu-iotests/089.out | 2 + tests/qemu-iotests/113 | 76 +++++++++++++++++++++++++++ tests/qemu-iotests/113.out | 15 ++++++ tests/qemu-iotests/common.rc | 4 +- tests/qemu-iotests/group | 1 + 17 files changed, 316 insertions(+), 24 deletions(-) create mode 100755 tests/qemu-iotests/113 create mode 100644 tests/qemu-iotests/113.out -- 1.9.3