Commit f0f4b930 authored by Sheng Yang's avatar Sheng Yang Committed by Marcelo Tosatti

KVM: Fix kvm_coalesced_mmio_ring duplicate allocation

The commit 0953ca73 "KVM: Simplify coalesced mmio initialization"
allocate kvm_coalesced_mmio_ring in the kvm_coalesced_mmio_init(), but
didn't discard the original allocation...
Signed-off-by: default avatarSheng Yang <sheng@linux.intel.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 727f5a23
...@@ -371,9 +371,6 @@ static struct kvm *kvm_create_vm(void) ...@@ -371,9 +371,6 @@ static struct kvm *kvm_create_vm(void)
{ {
int r = 0, i; int r = 0, i;
struct kvm *kvm = kvm_arch_create_vm(); struct kvm *kvm = kvm_arch_create_vm();
#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
struct page *page;
#endif
if (IS_ERR(kvm)) if (IS_ERR(kvm))
goto out; goto out;
...@@ -402,23 +399,9 @@ static struct kvm *kvm_create_vm(void) ...@@ -402,23 +399,9 @@ static struct kvm *kvm_create_vm(void)
} }
} }
#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (!page) {
cleanup_srcu_struct(&kvm->srcu);
goto out_err;
}
kvm->coalesced_mmio_ring =
(struct kvm_coalesced_mmio_ring *)page_address(page);
#endif
r = kvm_init_mmu_notifier(kvm); r = kvm_init_mmu_notifier(kvm);
if (r) { if (r) {
cleanup_srcu_struct(&kvm->srcu); cleanup_srcu_struct(&kvm->srcu);
#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
put_page(page);
#endif
goto out_err; goto out_err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment