Skip to content

Commit d29bf2c

Browse files
committed
KVM: x86: Prevent excluding the BSP on setting max_vcpu_ids
If the BSP vCPU ID was already set, ensure it doesn't get excluded when limiting vCPU IDs via KVM_CAP_MAX_VCPU_ID. [mks: provide commit message, code by Sean] Signed-off-by: Mathias Krause <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 7c305d5 commit d29bf2c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6707,7 +6707,9 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
67076707
break;
67086708

67096709
mutex_lock(&kvm->lock);
6710-
if (kvm->arch.max_vcpu_ids == cap->args[0]) {
6710+
if (kvm->arch.bsp_vcpu_id > cap->args[0]) {
6711+
;
6712+
} else if (kvm->arch.max_vcpu_ids == cap->args[0]) {
67116713
r = 0;
67126714
} else if (!kvm->arch.max_vcpu_ids) {
67136715
kvm->arch.max_vcpu_ids = cap->args[0];

0 commit comments

Comments
 (0)