From: Radim Krčmář Date: Thu, 29 Jan 2015 21:48:51 +0000 (+0100) Subject: KVM: x86: fix x2apic logical address matching X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=8a395363e2f9f52ec44a1cd892881e8ee1a53269;p=openwrt%2Fstaging%2Fblogic.git KVM: x86: fix x2apic logical address matching We cannot hit the bug now, but future patches will expose this path. Signed-off-by: Radim Krčmář Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 99c536597332..555956c3c473 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -599,7 +599,8 @@ static bool kvm_apic_match_logical_addr(struct kvm_lapic *apic, u32 mda) logical_id = kvm_apic_get_reg(apic, APIC_LDR); if (apic_x2apic_mode(apic)) - return (logical_id & mda) != 0; + return ((logical_id >> 16) == (mda >> 16)) + && (logical_id & mda & 0xffff) != 0; logical_id = GET_APIC_LOGICAL_ID(logical_id);