diff options
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 148ed666e311..2966c847d489 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -5113,17 +5113,20 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu) | |||
5113 | !kvm_event_needs_reinjection(vcpu); | 5113 | !kvm_event_needs_reinjection(vcpu); |
5114 | } | 5114 | } |
5115 | 5115 | ||
5116 | static void vapic_enter(struct kvm_vcpu *vcpu) | 5116 | static int vapic_enter(struct kvm_vcpu *vcpu) |
5117 | { | 5117 | { |
5118 | struct kvm_lapic *apic = vcpu->arch.apic; | 5118 | struct kvm_lapic *apic = vcpu->arch.apic; |
5119 | struct page *page; | 5119 | struct page *page; |
5120 | 5120 | ||
5121 | if (!apic || !apic->vapic_addr) | 5121 | if (!apic || !apic->vapic_addr) |
5122 | return; | 5122 | return 0; |
5123 | 5123 | ||
5124 | page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); | 5124 | page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); |
5125 | if (is_error_page(page)) | ||
5126 | return -EFAULT; | ||
5125 | 5127 | ||
5126 | vcpu->arch.apic->vapic_page = page; | 5128 | vcpu->arch.apic->vapic_page = page; |
5129 | return 0; | ||
5127 | } | 5130 | } |
5128 | 5131 | ||
5129 | static void vapic_exit(struct kvm_vcpu *vcpu) | 5132 | static void vapic_exit(struct kvm_vcpu *vcpu) |
@@ -5430,7 +5433,11 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) | |||
5430 | } | 5433 | } |
5431 | 5434 | ||
5432 | vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); | 5435 | vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); |
5433 | vapic_enter(vcpu); | 5436 | r = vapic_enter(vcpu); |
5437 | if (r) { | ||
5438 | srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); | ||
5439 | return r; | ||
5440 | } | ||
5434 | 5441 | ||
5435 | r = 1; | 5442 | r = 1; |
5436 | while (r > 0) { | 5443 | while (r > 0) { |