aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2013-05-31 16:52:18 +0800
committerAnthony Liguori <aliguori@us.ibm.com>2013-06-03 15:21:27 -0500
commit651eb0f41b793021f7de672de78892def5819fb9 (patch)
tree03175cafce0ba8bef54f9076e1046ae6effe196f
parent25b483381adf4144bad3cf3f433b4658da5e15bb (diff)
downloadqemu-651eb0f41b793021f7de672de78892def5819fb9.zip
qemu-651eb0f41b793021f7de672de78892def5819fb9.tar.gz
qemu-651eb0f41b793021f7de672de78892def5819fb9.tar.bz2
fix double free the memslot in kvm_set_phys_mem
Luiz Capitulino reported that guest refused to boot and qemu complained with: kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument It is caused by commit 235e8982ad that did double free for the memslot so that the second one raises the -EINVAL error Fix it by reset memory size only if it is needed Reported-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--kvm-all.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 8e7bbf8..405480e 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
if (s->migration_log) {
mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
}
- if (mem.flags & KVM_MEM_READONLY) {
+
+ if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
/* Set the slot size to 0 before setting the slot to the desired
* value. This is needed based on KVM commit 75d61fbc. */
mem.memory_size = 0;