kvm:x86:Fix error checking in the function pf_interception
Quoted 18 lines · Nicholas Krause
This fixes error checking in the function
pf_interceptionby checking if the call tokvm_mmu_unprotect_page_virtreturns zero to indicate the function has failed internally and if this occurs we must return immediately to the caller of the functionpf_interceptionwith the return value of zero from the call to the functionkvm_mmu_unprotect_page_virtto indicate failure to the caller of the functionpf_interception.Signed-off-by Nicholas Krause <[email protected]>--- arch/x86/kvm/svm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)arch/x86/kvm/svm.c +0
-0
arch/x86/kvm/svm.c static int pf_interception(struct vcpu_svm *svm) · line 1821
Quoted 10 lines
arch/x86/kvm/svm.c +5
-2@@ -1814,8 +1814,11 @@ static int pf_interception(struct vcpu_svm *svm) error_code = svm->vmcb->control.exit_info_1;trace_kvm_page_fault (fault_address, error_code); -if (!npt_enabled &&kvm_event_needs_reinjection (&svm->vcpu)) -kvm_mmu_unprotect_page_virt (&svm->vcpu, fault_address); +if (!npt_enabled &&kvm_event_needs_reinjection (&svm->vcpu)) { + r =kvm_mmu_unprotect_page_virt (&svm->vcpu, fault_address); +if (!r) +break ; + }
NAK. kvm_mmu_unprotect_page_virt does not return an error but whether it unprotected a page or not. This patch breaks SVM.