public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create()
@ 2010-03-09  6:37 Wei Yongjun
  2010-03-09 12:30 ` Carsten Otte
  2010-03-09 12:42 ` Avi Kivity
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2010-03-09  6:37 UTC (permalink / raw)
  To: kvm

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>
---
 arch/s390/kvm/kvm-s390.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 8f09959..f07d65f 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -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:
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create()
  2010-03-09  6:37 [PATCH] KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create() Wei Yongjun
@ 2010-03-09 12:30 ` Carsten Otte
  2010-03-09 12:42 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Otte @ 2010-03-09 12:30 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: kvm

Wei Yongjun wrote:
> 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!

Acked-by: Carsten Otte <cotte@de.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create()
  2010-03-09  6:37 [PATCH] KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create() Wei Yongjun
  2010-03-09 12:30 ` Carsten Otte
@ 2010-03-09 12:42 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2010-03-09 12:42 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: kvm

On 03/09/2010 08:37 AM, Wei Yongjun wrote:
> This patch fixed possible memory leak in kvm_arch_vcpu_create()
> under s390, which would happen when kvm_arch_vcpu_create() fails.
>   

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-09 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09  6:37 [PATCH] KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create() Wei Yongjun
2010-03-09 12:30 ` Carsten Otte
2010-03-09 12:42 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox