From: Marcelo Tosatti Date: Thu, 8 May 2008 22:47:01 +0000 (-0300) Subject: KVM: Fix kvm_vcpu_block() task state race X-Git-Tag: v2.6.26-rc4~122^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5c239cfd5b0ec22751c099dbf4d91f3c504a64f;p=pandora-kernel.git KVM: Fix kvm_vcpu_block() task state race There's still a race in kvm_vcpu_block(), if a wake_up_interruptible() call happens before the task state is set to TASK_INTERRUPTIBLE: CPU0 CPU1 kvm_vcpu_block add_wait_queue kvm_cpu_has_interrupt = 0 set interrupt if (waitqueue_active()) wake_up_interruptible() kvm_cpu_has_pending_timer kvm_arch_vcpu_runnable signal_pending set_current_state(TASK_INTERRUPTIBLE) schedule() Can be fixed by using prepare_to_wait() which sets the task state before testing for the wait condition. Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity --- Reading git-diff-tree failed