diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-07-13 10:38:49 +0300 |
---|---|---|
committer | Paul Mackerras <paulus@ozlabs.org> | 2017-08-31 12:36:44 +1000 |
commit | 50a1a25987146c5ab15d6c1642a5043730ace0a5 (patch) | |
tree | d29f5f801fdb0178fb1c3f741b6d718252b7729c /arch/powerpc/kvm | |
parent | 73e77c0982fd25ddb536339906412cbed78d0b79 (diff) | |
download | linux-stable-50a1a25987146c5ab15d6c1642a5043730ace0a5.tar.gz linux-stable-50a1a25987146c5ab15d6c1642a5043730ace0a5.tar.bz2 linux-stable-50a1a25987146c5ab15d6c1642a5043730ace0a5.zip |
KVM: PPC: e500mc: Fix a NULL dereference
We should set "err = -ENOMEM;", otherwise it means we're returning
ERR_PTR(0) which is NULL. It results in a NULL pointer dereference in
the caller.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/e500mc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index f48a0c22e8f9..d0b6b5788afc 100644 --- a/arch/powerpc/kvm/e500mc.c +++ b/arch/powerpc/kvm/e500mc.c @@ -331,8 +331,10 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_e500mc(struct kvm *kvm, goto uninit_vcpu; vcpu->arch.shared = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); - if (!vcpu->arch.shared) + if (!vcpu->arch.shared) { + err = -ENOMEM; goto uninit_tlb; + } return vcpu; |