diff options
author | Nicholas Krause <xerofoify@gmail.com> | 2015-08-05 10:44:40 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-08-11 09:11:05 -0400 |
commit | 603242a88ac44771442b077e0c9cb4d3af2b796f (patch) | |
tree | b913214c14c5f7f4214c717132606201d4bcc3bb | |
parent | f735d4af4b0ec3d87885710adf18b077480e7b19 (diff) |
kvm: x86: Fix error handling in the function kvm_lapic_sync_from_vapic
This fixes error handling in the function kvm_lapic_sync_from_vapic
by checking if the call to kvm_read_guest_cached has 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
of kvm_lapic_sync_from_vapic to avoid incorrectly call apic_set_tpc
if a error has occurred here.
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/lapic.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 2a5ca97c263b..9a3e342e3cda 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1900,8 +1900,9 @@ void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu) | |||
1900 | if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention)) | 1900 | if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention)) |
1901 | return; | 1901 | return; |
1902 | 1902 | ||
1903 | kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, | 1903 | if (kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, |
1904 | sizeof(u32)); | 1904 | sizeof(u32))) |
1905 | return; | ||
1905 | 1906 | ||
1906 | apic_set_tpr(vcpu->arch.apic, data & 0xff); | 1907 | apic_set_tpr(vcpu->arch.apic, data & 0xff); |
1907 | } | 1908 | } |