Skip to content

Commit

Permalink
KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create()
Browse files Browse the repository at this point in the history
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 <yjwei@cn.fujitsu.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Cc: stable@kernel.org
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

(Cherry-picked from commit 7b06bf2)
  • Loading branch information
Wei Yongjun authored and gregkh committed Jul 5, 2010
1 parent bdb19d4 commit d11e1d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/s390/kvm/kvm-s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d11e1d9

Please sign in to comment.