Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1378b1c authored by Paul Mackerras's avatar Paul Mackerras Committed by Alexander Graf
Browse files

kvm: powerpc: book3s hv: Fix vcore leak



add kvmppc_free_vcores() to free the kvmppc_vcore structures
that we allocate for a guest, which are currently being leaked.

Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 491d6ecc
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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;