summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2020-02-18 22:07:17 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-16 17:57:15 +0100
commit13f678894bd0112582ea26e9b98db5118150d6a9 (patch)
treed5b361cb656b21d52054768f0c03981c3c419fe6 /virt
parentKVM: Reinstall old memslots if arch preparation fails (diff)
downloadlinux-13f678894bd0112582ea26e9b98db5118150d6a9.tar.xz
linux-13f678894bd0112582ea26e9b98db5118150d6a9.zip
KVM: Don't free new memslot if allocation of said memslot fails
The two implementations of kvm_arch_create_memslot() in x86 and PPC are both good citizens and free up all local resources if creation fails. Return immediately (via a superfluous goto) instead of calling kvm_free_memslot(). Note, the call to kvm_free_memslot() is effectively an expensive nop in this case as there are no resources to be freed. No functional change intended. Acked-by: Christoffer Dall <christoffer.dall@arm.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 6e99525d7dce..af9eb59e6769 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1089,7 +1089,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
new.userspace_addr = mem->userspace_addr;
if (kvm_arch_create_memslot(kvm, &new, npages))
- goto out_free;
+ goto out;
}
/* Allocate page dirty bitmap if needed */