* [PATCH] KVM: PPC: check error return of kvmppc_core_vcpu_create first
@ 2012-02-21 4:30 ` Ben Collins
0 siblings, 0 replies; 4+ messages in thread
From: Ben Collins @ 2012-02-21 4:30 UTC (permalink / raw)
To: Alexander Graf; +Cc: kvm-ppc, linux-kernel
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/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] KVM: PPC: check error return of kvmppc_core_vcpu_create first
@ 2012-02-21 4:30 ` Ben Collins
0 siblings, 0 replies; 4+ messages in thread
From: Ben Collins @ 2012-02-21 4:30 UTC (permalink / raw)
To: Alexander Graf; +Cc: kvm-ppc, linux-kernel
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/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: PPC: check error return of kvmppc_core_vcpu_create first
2012-02-21 4:30 ` Ben Collins
@ 2012-03-05 18:10 ` Alexander Graf
-1 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2012-03-05 18:10 UTC (permalink / raw)
To: Ben Collins; +Cc: kvm-ppc, linux-kernel
On 02/21/2012 05:30 AM, Ben Collins wrote:
> 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.
Nice catch, but this has already been fixed by Matt:
commit c6f3830e7313eea47b526b597aadc5b18c69ad55
Author: Matt Evans <matt@ozlabs.org>
Date: Tue Dec 6 21:19:42 2011 +0000
KVM: PPC: Fix vcpu_create dereference before validity check.
Fix usage of vcpu struct before check that it's actually valid.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Thanks a lot for sending the patch nevertheless!
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: PPC: check error return of kvmppc_core_vcpu_create first
@ 2012-03-05 18:10 ` Alexander Graf
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2012-03-05 18:10 UTC (permalink / raw)
To: Ben Collins; +Cc: kvm-ppc, linux-kernel
On 02/21/2012 05:30 AM, Ben Collins wrote:
> 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.
Nice catch, but this has already been fixed by Matt:
commit c6f3830e7313eea47b526b597aadc5b18c69ad55
Author: Matt Evans <matt@ozlabs.org>
Date: Tue Dec 6 21:19:42 2011 +0000
KVM: PPC: Fix vcpu_create dereference before validity check.
Fix usage of vcpu struct before check that it's actually valid.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Thanks a lot for sending the patch nevertheless!
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-05 18:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-21 4:30 [PATCH] KVM: PPC: check error return of kvmppc_core_vcpu_create first Ben Collins
2012-02-21 4:30 ` Ben Collins
2012-03-05 18:10 ` Alexander Graf
2012-03-05 18:10 ` Alexander Graf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.