Skip to content

Commit 03cdab5

Browse files
evansm7avikivity
authored andcommitted
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 <[email protected]> Signed-off-by: Alexander Graf <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent 4cf302b commit 03cdab5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/powerpc/kvm/powerpc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,10 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
289289
{
290290
struct kvm_vcpu *vcpu;
291291
vcpu = kvmppc_core_vcpu_create(kvm, id);
292-
vcpu->arch.wqp = &vcpu->wq;
293-
if (!IS_ERR(vcpu))
292+
if (!IS_ERR(vcpu)) {
293+
vcpu->arch.wqp = &vcpu->wq;
294294
kvmppc_create_vcpu_debugfs(vcpu, id);
295+
}
295296
return vcpu;
296297
}
297298

0 commit comments

Comments
 (0)