KVM: x86: missing locking in PIT/IRQCHIP/SET_BSP_CPU ioctl paths

Correct missing locking in a few places in x86's vm_ioctl handling path.

Signed-off-by: Marcelo Tosatti <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
This commit is contained in:
Marcelo Tosatti 2009-06-23 15:05:14 -03:00 • committed by Avi Kivity
commit 894a9c5543
3 changed files with 14 additions and 2 deletions

View file

@ -2274,10 +2274,12 @@ static long kvm_vm_ioctl(struct file *filp,
#ifdef CONFIG_KVM_APIC_ARCHITECTURE
case KVM_SET_BOOT_CPU_ID:
r = 0;
mutex_lock(&kvm->lock);
if (atomic_read(&kvm->online_vcpus) != 0)
r = -EBUSY;
else
kvm->bsp_vcpu_id = arg;
mutex_unlock(&kvm->lock);
break;
#endif
default: