Skip to content

Commit 63961ac

Browse files
lrq-maxgregkh
authored andcommitted
KVM: x86: fix sending PV IPI
commit c15e0ae upstream. If apic_id is less than min, and (max - apic_id) is greater than KVM_IPI_CLUSTER_SIZE, then the third check condition is satisfied but the new apic_id does not fit the bitmask. In this case __send_ipi_mask should send the IPI. This is mostly theoretical, but it can happen if the apic_ids on three iterations of the loop are for example 1, KVM_IPI_CLUSTER_SIZE, 0. Fixes: aaffcfd ("KVM: X86: Implement PV IPIs in linux guest") Signed-off-by: Li RongQing <lirongqing@baidu.com> Message-Id: <1646814944-51801-1-git-send-email-lirongqing@baidu.com> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 43637ee commit 63961ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/kvm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector)
510510
} else if (apic_id < min && max - apic_id < KVM_IPI_CLUSTER_SIZE) {
511511
ipi_bitmap <<= min - apic_id;
512512
min = apic_id;
513-
} else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) {
513+
} else if (apic_id > min && apic_id < min + KVM_IPI_CLUSTER_SIZE) {
514514
max = apic_id < max ? max : apic_id;
515515
} else {
516516
ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap,

0 commit comments

Comments
 (0)