Skip to contentSkip to conversation

KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create()

PATCH Applied Wei Yongjun 3 participants 3 messages Mar 9, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create()

This patch fixed possible memory leak in kvm_arch_vcpu_create() under s390, which would happen when kvm_arch_vcpu_create() fails.

---
 arch/s390/kvm/kvm-s390.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/s390/kvm/kvm-s390.c +3 -1
index 8f09959..f07d65f 100644
@@ -340,11 +340,13 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
 
 	rc = kvm_vcpu_init(vcpu, kvm, id);
 	if (rc)
-		goto out_free_cpu;
+		goto out_free_sie_block;
 	VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu,
 		 vcpu->arch.sie_block);
 
 	return vcpu;
+out_free_sie_block:
+	free_page((unsigned long)(vcpu->arch.sie_block));
 out_free_cpu:
 	kfree(vcpu);
 out_nomem:
Signature · 1 line
1.6.3.3
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Wei Yongjun

This patch fixed possible memory leak in kvm_arch_vcpu_create() under s390, which would happen when kvm_arch_vcpu_create() fails.

Good catch, thanks!

Applied
#2 lore raw
In reply to Wei Yongjun
Quoted 3 lines · Wei Yongjun

This patch fixed possible memory leak in kvm_arch_vcpu_create() under s390, which would happen when kvm_arch_vcpu_create() fails.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function