aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-06-12 10:43:32 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-06-12 10:43:32 +0100
commit475df9d809b1f3a7ebe8b15abd208216591f0143 (patch)
tree887ca246dba04fb0f1752ccdbf44cb473eef8e82 /block
parentbbfa326fc8028e275eddf8c9965c2a1b59405b2e (diff)
parent719fc28c80a22ab9f1533d775bae09c14442bbbe (diff)
downloadqemu-475df9d809b1f3a7ebe8b15abd208216591f0143.zip
qemu-475df9d809b1f3a7ebe8b15abd208216591f0143.tar.gz
qemu-475df9d809b1f3a7ebe8b15abd208216591f0143.tar.bz2
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches # gpg: Signature made Fri 09 Jun 2017 12:47:31 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: block: fix external snapshot abort permission error block/qcow.c: Fix memory leak in qcow_create() qemu-iotests: Test automatic commit job cancel on hot unplug commit: Fix use after free in completion qemu-iotests: Block migration test migration/block: Clean up BBs in block_save_complete() migration: Inactivate images after .save_live_complete_precopy() block: Fix anonymous BBs in blk_root_inactivate() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c2
-rw-r--r--block/commit.c7
-rw-r--r--block/qcow.c1
3 files changed, 9 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index f3a6008..7d7f369 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -168,7 +168,7 @@ static int blk_root_inactivate(BdrvChild *child)
* this point because the VM is stopped) and unattached monitor-owned
* BlockBackends. If there is still any other user like a block job, then
* we simply can't inactivate the image. */
- if (!blk->dev && !blk->name[0]) {
+ if (!blk->dev && !blk_name(blk)[0]) {
return -EPERM;
}
diff --git a/block/commit.c b/block/commit.c
index a3028b2..af6fa68 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -89,6 +89,10 @@ static void commit_complete(BlockJob *job, void *opaque)
int ret = data->ret;
bool remove_commit_top_bs = false;
+ /* Make sure overlay_bs and top stay around until bdrv_set_backing_hd() */
+ bdrv_ref(top);
+ bdrv_ref(overlay_bs);
+
/* Remove base node parent that still uses BLK_PERM_WRITE/RESIZE before
* the normal backing chain can be restored. */
blk_unref(s->base);
@@ -124,6 +128,9 @@ static void commit_complete(BlockJob *job, void *opaque)
if (remove_commit_top_bs) {
bdrv_set_backing_hd(overlay_bs, top, &error_abort);
}
+
+ bdrv_unref(overlay_bs);
+ bdrv_unref(top);
}
static void coroutine_fn commit_run(void *opaque)
diff --git a/block/qcow.c b/block/qcow.c
index 95ab123..7bd94dc 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -852,6 +852,7 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)
header_size += backing_filename_len;
} else {
/* special backing file for vvfat */
+ g_free(backing_file);
backing_file = NULL;
}
header.cluster_bits = 9; /* 512 byte cluster to avoid copying