[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 04/18] qcow: require image size to be > 1 for new
From: |
Daniel P. Berrange |
Subject: |
[Qemu-devel] [PATCH v6 04/18] qcow: require image size to be > 1 for new images |
Date: |
Tue, 25 Apr 2017 16:38:44 +0100 |
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>
---
block/qcow.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/qcow.c b/block/qcow.c
index 9d6ac83..d6ce46c 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.3
[Qemu-devel] [PATCH v6 03/18] qcow: document another weakness of qcow AES encryption, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 01/18] block: expose crypto option names / defs to other drivers, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 04/18] qcow: require image size to be > 1 for new images,
Daniel P. Berrange <=
[Qemu-devel] [PATCH v6 06/18] iotests: skip 048 with qcow which doesn't support resize, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 05/18] iotests: skip 042 with qcow which dosn't support zero sized images, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 08/18] qcow: make encrypt_sectors encrypt in place, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 09/18] qcow: convert QCow to use QCryptoBlock for encryption, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 07/18] block: deprecate "encryption=on" in favour of "encrypt.format=aes", Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 12/18] qcow2: extend specification to cover LUKS encryption, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 10/18] qcow2: make qcow2_encrypt_sectors encrypt in place, Daniel P. Berrange, 2017/04/25
[Qemu-devel] [PATCH v6 11/18] qcow2: convert QCow2 to use QCryptoBlock for encryption, Daniel P. Berrange, 2017/04/25