]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: delay svm_vcpu_init_msrpm after svm->vmcb is initialized
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Jul 2021 16:39:01 +0000 (12:39 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 27 Jul 2021 20:59:00 +0000 (16:59 -0400)
commit973590b0aa973ed848eb047ee92309ea3f760f8a
tree888237497c59d17c1420de8384ffd7b43e4a0a93
parent46ef7c6f2884a903cf20cfe190a37230d27a89fe
KVM: SVM: delay svm_vcpu_init_msrpm after svm->vmcb is initialized

Right now, svm_hv_vmcb_dirty_nested_enlightenments has an incorrect
dereference of vmcb->control.reserved_sw before the vmcb is checked
for being non-NULL.  The compiler is usually sinking the dereference
after the check; instead of doing this ourselves in the source,
ensure that svm_hv_vmcb_dirty_nested_enlightenments is only called
with a non-NULL VMCB.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Vineeth Pillai <viremana@linux.microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Untested for now due to issues with my AMD machine. - Paolo]
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm_onhyperv.h