x86:kvm:Fix error handling in the function kvm_lapic_sync_from_vapic
Paolo Bonzini
maintainerQuoted 19 lines · Nicholas Krause
This fixes error handling in the function
kvm_lapic_sync_from_vapicby checking if the call tokvm_read_guest_cachedhas returned a error code to signal to its caller the call to this function has failed and due to this we must immediately return to the caller ofkvm_lapic_sync_from_vapicto avoid incorrectly callapic_set_tpcif a error has occurred here.Signed-off-by Nicholas Krause <[email protected]>--- arch/x86/kvm/lapic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/x86/kvm/lapic.c +0
-0@@ -1900,8 +1900,9 @@ void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu)if (!test_bit (KVM_APIC_CHECK_VAPIC , &vcpu->arch.apic_attention))
arch/x86/kvm/lapic.c void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu) · line 1908
Quoted 10 lines
arch/x86/kvm/lapic.c +3
-2return ; -kvm_read_guest_cached (vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, -sizeof (u32)); +if (kvm_read_guest_cached (vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, +sizeof (u32))) +return ;apic_set_tpr (vcpu->arch.apic, data &0xff ); }
Congratulations, this patch is good! :)
I'm applying it to kvm.git's queue branch.
Paolo