From: Wei Yongjun Date: Tue, 9 Mar 2010 06:37:53 +0000 (+0800) Subject: KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create() X-Git-Tag: firefly_0821_release~9833^2~2050^2~194 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7b06bf2ffa15e119c7439ed0b024d44f66d7b605;p=firefly-linux-kernel-4.4.55.git 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. Signed-off-by: Wei Yongjun Acked-by: Carsten Otte Cc: stable@kernel.org Signed-off-by: Avi Kivity --- diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 49292869a5cd..ee7c713686ce 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -341,11 +341,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: