* [Qemu-devel] [PULL 1/3] qcow: fix memory leaks related to encryption
2017-07-25 15:12 [Qemu-devel] [PULL 0/3] Block patches for 2.10-rc0 Max Reitz
@ 2017-07-25 15:12 ` Max Reitz
2017-07-25 15:12 ` [Qemu-devel] [PULL 2/3] qcow2-bitmap: fix bitmap_free Max Reitz
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Max Reitz @ 2017-07-25 15:12 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, Max Reitz
From: "Daniel P. Berrange" <berrange@redhat.com>
Fix leak of the 'encryptopts' string, which was mistakenly
declared const.
Fix leak of QemuOpts entry which should not have been deleted
from the opts array.
Reported by: coverity
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170714103105.5781-1-berrange@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/qcow.c | 5 +++--
block/qcow2.c | 7 ++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/block/qcow.c b/block/qcow.c
index 66827d6..c08cdc4 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -768,7 +768,7 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)
Error *local_err = NULL;
int ret;
BlockBackend *qcow_blk;
- const char *encryptfmt = NULL;
+ char *encryptfmt = NULL;
QDict *options;
QDict *encryptopts = NULL;
QCryptoBlockCreateOptions *crypto_opts = NULL;
@@ -793,7 +793,7 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)
goto cleanup;
}
} else if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) {
- encryptfmt = "aes";
+ encryptfmt = g_strdup("aes");
}
ret = bdrv_create_file(filename, opts, &local_err);
@@ -908,6 +908,7 @@ exit:
blk_unref(qcow_blk);
cleanup:
QDECREF(encryptopts);
+ g_free(encryptfmt);
qcrypto_block_free(crypto);
qapi_free_QCryptoBlockCreateOptions(crypto_opts);
g_free(backing_file);
diff --git a/block/qcow2.c b/block/qcow2.c
index 90efa44..d7c600b 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2905,7 +2905,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)
int version;
uint64_t refcount_bits;
int refcount_order;
- const char *encryptfmt = NULL;
+ char *encryptfmt = NULL;
Error *local_err = NULL;
int ret;
@@ -2916,14 +2916,14 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)
backing_fmt = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FMT);
encryptfmt = qemu_opt_get_del(opts, BLOCK_OPT_ENCRYPT_FORMAT);
if (encryptfmt) {
- if (qemu_opt_get_del(opts, BLOCK_OPT_ENCRYPT)) {
+ if (qemu_opt_get(opts, BLOCK_OPT_ENCRYPT)) {
error_setg(errp, "Options " BLOCK_OPT_ENCRYPT " and "
BLOCK_OPT_ENCRYPT_FORMAT " are mutually exclusive");
ret = -EINVAL;
goto finish;
}
} else if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) {
- encryptfmt = "aes";
+ encryptfmt = g_strdup("aes");
}
cluster_size = qcow2_opt_get_cluster_size_del(opts, &local_err);
if (local_err) {
@@ -2983,6 +2983,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)
finish:
g_free(backing_file);
g_free(backing_fmt);
+ g_free(encryptfmt);
g_free(buf);
return ret;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL 2/3] qcow2-bitmap: fix bitmap_free
2017-07-25 15:12 [Qemu-devel] [PULL 0/3] Block patches for 2.10-rc0 Max Reitz
2017-07-25 15:12 ` [Qemu-devel] [PULL 1/3] qcow: fix memory leaks related to encryption Max Reitz
@ 2017-07-25 15:12 ` Max Reitz
2017-07-25 15:12 ` [Qemu-devel] [PULL 3/3] qemu-iotests: Fix reference output for 186 Max Reitz
2017-07-25 16:12 ` [Qemu-devel] [PULL 0/3] Block patches for 2.10-rc0 Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Max Reitz @ 2017-07-25 15:12 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, Max Reitz
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Fix possible crash on error path in
qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in
88ddffae8fc the bug was introduced later in commit 469c71edc72 (when
qcow2_remove_persistent_dirty_bitmap was added).
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170714123341.373857-1-vsementsov@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/qcow2-bitmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 3e8735a..e8d3bdb 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -487,6 +487,10 @@ static inline void bitmap_directory_to_be(uint8_t *dir, size_t size)
static void bitmap_free(Qcow2Bitmap *bm)
{
+ if (bm == NULL) {
+ return;
+ }
+
g_free(bm->name);
g_free(bm);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL 3/3] qemu-iotests: Fix reference output for 186
2017-07-25 15:12 [Qemu-devel] [PULL 0/3] Block patches for 2.10-rc0 Max Reitz
2017-07-25 15:12 ` [Qemu-devel] [PULL 1/3] qcow: fix memory leaks related to encryption Max Reitz
2017-07-25 15:12 ` [Qemu-devel] [PULL 2/3] qcow2-bitmap: fix bitmap_free Max Reitz
@ 2017-07-25 15:12 ` Max Reitz
2017-07-25 16:12 ` [Qemu-devel] [PULL 0/3] Block patches for 2.10-rc0 Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Max Reitz @ 2017-07-25 15:12 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, Max Reitz
From: Kevin Wolf <kwolf@redhat.com>
Commits 70f17a1 ('error: Revert unwanted change of warning messages')
and e1824e5 ('qemu-iotests: Test 'info block'') had a semantic merge
conflict, which results in failure for qemu-iotests case 186. Fix the
reference output to consider the changes of 70f17a1.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1500973176-29235-1-git-send-email-kwolf@redhat.com
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/186.out | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out
index b963b12..b8bf9a2 100644
--- a/tests/qemu-iotests/186.out
+++ b/tests/qemu-iotests/186.out
@@ -442,7 +442,7 @@ ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
Cache mode: writeback
(qemu) quit
-warning: qemu-system-x86_64: -drive if=scsi,driver=null-co: bus=0,unit=0 is deprecated with this machine type
+qemu-system-x86_64: -drive if=scsi,driver=null-co: warning: bus=0,unit=0 is deprecated with this machine type
Testing: -drive if=scsi,driver=null-co
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) info block
@@ -451,7 +451,7 @@ scsi0-hd0 (NODE_NAME): null-co:// (null-co)
Cache mode: writeback
(qemu) quit
-warning: qemu-system-x86_64: -drive if=scsi,media=cdrom: bus=0,unit=0 is deprecated with this machine type
+qemu-system-x86_64: -drive if=scsi,media=cdrom: warning: bus=0,unit=0 is deprecated with this machine type
Testing: -drive if=scsi,media=cdrom
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) info block
@@ -460,7 +460,7 @@ scsi0-cd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
-warning: qemu-system-x86_64: -drive if=scsi,driver=null-co,media=cdrom: bus=0,unit=0 is deprecated with this machine type
+qemu-system-x86_64: -drive if=scsi,driver=null-co,media=cdrom: warning: bus=0,unit=0 is deprecated with this machine type
Testing: -drive if=scsi,driver=null-co,media=cdrom
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) info block
--
2.9.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] Block patches for 2.10-rc0
2017-07-25 15:12 [Qemu-devel] [PULL 0/3] Block patches for 2.10-rc0 Max Reitz
` (2 preceding siblings ...)
2017-07-25 15:12 ` [Qemu-devel] [PULL 3/3] qemu-iotests: Fix reference output for 186 Max Reitz
@ 2017-07-25 16:12 ` Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2017-07-25 16:12 UTC (permalink / raw)
To: Max Reitz; +Cc: Qemu-block, QEMU Developers
On 25 July 2017 at 16:12, Max Reitz <mreitz@redhat.com> wrote:
> The following changes since commit 4c4414a4388f902b7ae2814f9a64898dd0e426a5:
>
> hw/display/sm501: Don't use vmstate_register_ram_global() (2017-07-25 13:04:28 +0100)
>
> are available in the git repository at:
>
> git://github.com/XanClic/qemu.git tags/pull-block-2017-07-25
>
> for you to fetch changes up to bd998d7cc8ced211def90e4225042d63dddecc54:
>
> qemu-iotests: Fix reference output for 186 (2017-07-25 16:33:58 +0200)
>
> ----------------------------------------------------------------
> Block patches for 2.10-rc0
>
> ----------------------------------------------------------------
> Daniel P. Berrange (1):
> qcow: fix memory leaks related to encryption
>
> Kevin Wolf (1):
> qemu-iotests: Fix reference output for 186
>
> Vladimir Sementsov-Ogievskiy (1):
> qcow2-bitmap: fix bitmap_free
>
> block/qcow.c | 5 +++--
> block/qcow2-bitmap.c | 4 ++++
> block/qcow2.c | 7 ++++---
> tests/qemu-iotests/186.out | 6 +++---
> 4 files changed, 14 insertions(+), 8 deletions(-)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread