aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-03-14 12:49:37 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-14 12:49:37 +0100
commit018cabb694e3923998fdc2908af5268f1d89f48f (patch)
tree7313c41ba7ebfc45073b1f6ce991a3451646f535 /arch
parentMerge tag 'kvm-s390-master-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into kvm-master (diff)
parentKVM: nVMX: avoid NULL pointer dereference with incorrect EVMCS GPAs (diff)
downloadlinux-dev-018cabb694e3923998fdc2908af5268f1d89f48f.tar.xz
linux-dev-018cabb694e3923998fdc2908af5268f1d89f48f.zip
Merge branch 'kvm-null-pointer-fix' into kvm-master
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/vmx/nested.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index e920d7834d73..9750e590c89d 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -224,7 +224,7 @@ static inline void nested_release_evmcs(struct kvm_vcpu *vcpu)
return;
kvm_vcpu_unmap(vcpu, &vmx->nested.hv_evmcs_map, true);
- vmx->nested.hv_evmcs_vmptr = -1ull;
+ vmx->nested.hv_evmcs_vmptr = 0;
vmx->nested.hv_evmcs = NULL;
}
@@ -1923,7 +1923,8 @@ static int nested_vmx_handle_enlightened_vmptrld(struct kvm_vcpu *vcpu,
if (!nested_enlightened_vmentry(vcpu, &evmcs_gpa))
return 1;
- if (unlikely(evmcs_gpa != vmx->nested.hv_evmcs_vmptr)) {
+ if (unlikely(!vmx->nested.hv_evmcs ||
+ evmcs_gpa != vmx->nested.hv_evmcs_vmptr)) {
if (!vmx->nested.hv_evmcs)
vmx->nested.current_vmptr = -1ull;