diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2024-08-16 15:01:24 +0200 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-08-22 20:35:18 +0200 |
commit | 2ab637df5f68d4e0cfa9becd10f43400aee785b3 (patch) | |
tree | f4bbd96e359793ec9067b66ea3a357d1d1ffabda /arch/x86/kvm/vmx/vmx.c | |
parent | KVM: nVMX: Use vmx_segment_cache_clear() instead of open coded equivalent (diff) | |
download | linux-2ab637df5f68d4e0cfa9becd10f43400aee785b3.tar.xz linux-2ab637df5f68d4e0cfa9becd10f43400aee785b3.zip |
KVM: VMX: hyper-v: Prevent impossible NULL pointer dereference in evmcs_load()
GCC 12.3.0 complains about a potential NULL pointer dereference in
evmcs_load() as hv_get_vp_assist_page() can return NULL. In fact, this
cannot happen because KVM verifies (hv_init_evmcs()) that every CPU has a
valid VP assist page and aborts enabling the feature otherwise. CPU
onlining path is also checked in vmx_hardware_enable().
To make the compiler happy and to future proof the code, add a KVM_BUG_ON()
sentinel. It doesn't seem to be possible (and logical) to observe
evmcs_load() happening without an active vCPU so it is presumed that
kvm_get_running_vcpu() can't return NULL.
No functional change intended.
Reported-by: Mirsad Todorovac <mtodorovac69@gmail.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Link: https://lore.kernel.org/r/20240816130124.286226-1-vkuznets@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/vmx/vmx.c')
0 files changed, 0 insertions, 0 deletions