Fix unlikely kvm_create vs decache_vcpus_on_cpu race
PATCH 1/1 Fix unlikely kvm_create vs decache_vcpus_on_cpu race
We add the kvm to the vm_list before initializing the vcpu mutexes, which can be mutex_trylock()'ed by decache_vcpus_on_cpu().
drivers/kvm/kvm_main.c +3 -3
@@ -310,9 +310,6 @@ static struct kvm *kvm_create_vm(void)kvm_io_bus_init (&kvm->pio_bus);spin_lock_init (&kvm->lock);INIT_LIST_HEAD (&kvm->active_mmu_pages); -spin_lock (&kvm_lock); -list_add (&kvm->vm_list, &vm_list); -spin_unlock (&kvm_lock);kvm_io_bus_init (&kvm->mmio_bus);for (i =0 ; i <KVM_MAX_VCPUS ; ++i) {struct kvm_vcpu *vcpu = &kvm->vcpus[i];
@@ -322,6 +319,9 @@ static struct kvm *kvm_create_vm(void) vcpu->kvm = kvm; vcpu->mmu.root_hpa =INVALID_PAGE ; } +spin_lock (&kvm_lock); +list_add (&kvm->vm_list, &vm_list); +spin_unlock (&kvm_lock);return kvm; }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 1185174501.6344.138.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Quoted 3 lines · Rusty Russell
We add the kvm to the
vm_listbefore initializing the vcpu mutexes, which can be mutex_trylock()'ed bydecache_vcpus_on_cpu().
Applied this as well as the next one.
Good to see a thorough non-CodingStyle review of the entire code base -- thanks!
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/