aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-03-09 18:14:01 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-03-15 18:23:33 +0100
commit39c350ee12e733070e63d64a21bd42607366ea99 (patch)
treea012cac68570005ddea9023903e562d8b15bb731
parente1fb6471999939539ecfb21b41cbbb24047fa4dc (diff)
exec: fix early return from ram_block_add
After reporting an error, ram_block_add was going on with the registration of the RAMBlock. The visible effect is that it unlocked the ramlist mutex twice. Fixes: 528f46af6ecd1e300db18684969104d4067b867b Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--exec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 274b619f88..f398d212f6 100644
--- a/exec.c
+++ b/exec.c
@@ -1589,6 +1589,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
if (err) {
error_propagate(errp, err);
qemu_mutex_unlock_ramlist();
+ return;
}
} else {
new_block->host = phys_mem_alloc(new_block->max_length,
@@ -1598,6 +1599,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
"cannot set up guest memory '%s'",
memory_region_name(new_block->mr));
qemu_mutex_unlock_ramlist();
+ return;
}
memory_try_enable_merging(new_block->host, new_block->max_length);
}