]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Return immediately if __kvm_gfn_to_hva_cache_init() fails
authorSean Christopherson <sean.j.christopherson@intel.com>
Thu, 9 Jan 2020 23:56:20 +0000 (15:56 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 27 Jan 2020 19:00:00 +0000 (20:00 +0100)
commitc1e6bd25e9b70981d3b21a7bee726b12eddc53aa
tree6721fb240edc28c3a5539fc824aacf24971de9b9
parentcd460f9853544b81c2ea1a3d10d39b1332318223
KVM: Return immediately if __kvm_gfn_to_hva_cache_init() fails

Check the result of __kvm_gfn_to_hva_cache_init() and return immediately
instead of relying on the kvm_is_error_hva() check to detect errors so
that it's abundantly clear KVM intends to immediately bail on an error.

Note, the hva check is still mandatory to handle errors on subqeuesnt
calls with the same generation.  Similarly, always return -EFAULT on
error so that multiple (bad) calls for a given generation will get the
same result, e.g. on an illegal gfn wrap, propagating the return from
__kvm_gfn_to_hva_cache_init() would cause the initial call to return
-EINVAL and subsequent calls to return -EFAULT.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c