]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/x86/kvm/lapic.c
KVM: x86: fix APIC physical destination wrapping
[karo-tx-linux.git] / arch / x86 / kvm / lapic.c
index 541e17865e63b6982af6b61ea5a1646b956440cd..bd82054664fdf98c747e339d7ecb5843d7b083fb 100644 (file)
@@ -693,7 +693,10 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
        ret = true;
 
        if (irq->dest_mode == 0) { /* physical mode */
-               dst = &map->phys_map[irq->dest_id & 0xff];
+               if (irq->dest_id >= ARRAY_SIZE(map->phys_map))
+                       goto out;
+
+               dst = &map->phys_map[irq->dest_id];
        } else {
                u32 mda = irq->dest_id << (32 - map->ldr_bits);