KVM: x86: Gracefully handle __vmalloc() failure during VM allocation
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 27 Jan 2020 00:41:11 +0000 (16:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2020 08:50:14 +0000 (10:50 +0200)
commit771b9374a529744c02c503b2a846c458a4aa5aa3
tree50d733db06b4c770a890375143fd7492ebf226f4
parent455f37affe13980e319800d74e66719fa513c6d6
KVM: x86: Gracefully handle __vmalloc() failure during VM allocation

commit d18b2f43b9147c8005ae0844fb445d8cc6a87e31 upstream.

Check the result of __vmalloc() to avoid dereferencing a NULL pointer in
the event that allocation failres.

Fixes: d1e5b0e98ea27 ("kvm: Make VM ioctl do valloc for some archs")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm.c
arch/x86/kvm/vmx/vmx.c