aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/lapic.c
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2014-11-27 14:03:12 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2014-12-04 09:29:07 -0500
commitfa834e919788dfa0965495f21760eb38fe480342 (patch)
treec5d672e0e098bfde84e7635616cb0dcea73e569f /arch/x86/kvm/lapic.c
parent085563fb043c29cc09e5ec5e21a7f6bb519d91e2 (diff)
KVM: x86: fix APIC physical destination wrapping
x2apic allows destinations > 0xff and we don't want them delivered to lower APICs. They are correctly handled by doing nothing. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/lapic.c')
-rw-r--r--arch/x86/kvm/lapic.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 541e17865e63..bd82054664fd 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -693,7 +693,10 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
693 ret = true; 693 ret = true;
694 694
695 if (irq->dest_mode == 0) { /* physical mode */ 695 if (irq->dest_mode == 0) { /* physical mode */
696 dst = &map->phys_map[irq->dest_id & 0xff]; 696 if (irq->dest_id >= ARRAY_SIZE(map->phys_map))
697 goto out;
698
699 dst = &map->phys_map[irq->dest_id];
697 } else { 700 } else {
698 u32 mda = irq->dest_id << (32 - map->ldr_bits); 701 u32 mda = irq->dest_id << (32 - map->ldr_bits);
699 702