[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/85] qcow: require image size to be > 1 for new ima
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 04/85] qcow: require image size to be > 1 for new images |
Date: |
Tue, 11 Jul 2017 18:06:53 +0200 |
From: "Daniel P. Berrange" <address@hidden>
The qcow driver refuses to open images which are less than
2 bytes in size, but will happily create such images. Add
a check in the create path to avoid this discrepancy.
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/qcow.c b/block/qcow.c
index 7bd94dc..49871fb 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -811,6 +811,12 @@ static int qcow_create(const char *filename, QemuOpts
*opts, Error **errp)
/* Read out options */
total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
BDRV_SECTOR_SIZE);
+ if (total_size == 0) {
+ error_setg(errp, "Image size is too small, cannot be zero length");
+ ret = -EINVAL;
+ goto cleanup;
+ }
+
backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE);
if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) {
flags |= BLOCK_FLAG_ENCRYPT;
--
2.9.4
- [Qemu-devel] [PULL 00/85] Block layer patches, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 01/85] block: expose crypto option names / defs to other drivers, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 02/85] block: add ability to set a prefix for opt names, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 03/85] qcow: document another weakness of qcow AES encryption, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 05/85] iotests: skip 042 with qcow which dosn't support zero sized images, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 04/85] qcow: require image size to be > 1 for new images,
Max Reitz <=
- [Qemu-devel] [PULL 06/85] iotests: skip 048 with qcow which doesn't support resize, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 08/85] qcow: make encrypt_sectors encrypt in place, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 10/85] qcow2: make qcow2_encrypt_sectors encrypt in place, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 09/85] qcow: convert QCow to use QCryptoBlock for encryption, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 07/85] block: deprecate "encryption=on" in favor of "encrypt.format=aes", Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 12/85] qcow2: extend specification to cover LUKS encryption, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 11/85] qcow2: convert QCow2 to use QCryptoBlock for encryption, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 14/85] qcow2: add iotests to cover LUKS encryption support, Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 15/85] iotests: enable tests 134 and 158 to work with qcow (v1), Max Reitz, 2017/07/11
- [Qemu-devel] [PULL 13/85] qcow2: add support for LUKS encryption format, Max Reitz, 2017/07/11