lkml.org 
[lkml]   [2012]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] KVM: PPC: check error return of kvmppc_core_vcpu_create first
Date
The result of kvmppc_core_vcpu_create() was being manipulated before it was checked for IS_ERR(). Did not see the bug occur, but caught it when looking through the code.

Signed-off-by: Ben Collins <bcollins@ubuntu.com>

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 607fbdf..8877614 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -278,10 +278,14 @@ void kvm_arch_flush_shadow(struct kvm *kvm)
struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
{
struct kvm_vcpu *vcpu;
+
vcpu = kvmppc_core_vcpu_create(kvm, id);
+ if (IS_ERR(vcpu))
+ return vcpu;
+
vcpu->arch.wqp = &vcpu->wq;
- if (!IS_ERR(vcpu))
- kvmppc_create_vcpu_debugfs(vcpu, id);
+ kvmppc_create_vcpu_debugfs(vcpu, id);
+
return vcpu;
}

--
Bluecherry: http://www.bluecherrydvr.com/
SwissDisk : http://www.swissdisk.com/
Ubuntu : http://www.ubuntu.com/
My Blog : http://ben-collins.blogspot.com/



\
 
 \ /
  Last update: 2012-02-21 05:33    [W:0.030 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site