Skip to content

Commit

Permalink
kvm: powerpc: book3s hv: Fix vcore leak
Browse files Browse the repository at this point in the history
add kvmppc_free_vcores() to free the kvmppc_vcore structures
that we allocate for a guest, which are currently being leaked.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
Paul Mackerras authored and Alexander Graf committed Oct 17, 2013
1 parent 491d6ec commit f1378b1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/powerpc/kvm/book3s_hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2050,10 +2050,20 @@ int kvmppc_core_init_vm(struct kvm *kvm)
return 0;
}

static void kvmppc_free_vcores(struct kvm *kvm)
{
long int i;

for (i = 0; i < KVM_MAX_VCORES; ++i)
kfree(kvm->arch.vcores[i]);
kvm->arch.online_vcores = 0;
}

void kvmppc_core_destroy_vm(struct kvm *kvm)
{
uninhibit_secondary_onlining();

kvmppc_free_vcores(kvm);
if (kvm->arch.rma) {
kvm_release_rma(kvm->arch.rma);
kvm->arch.rma = NULL;
Expand Down

0 comments on commit f1378b1

Please sign in to comment.