kvm: fix waitqueue_active without memory barrier in virt/kvm/async_pf.c
[firefly-linux-kernel-4.4.55.git] / virt / kvm / async_pf.c
index 44660aee335f93ad6114c1f521f5580c2c850254..77d42be6970ed88cd5812ecea855db267a333468 100644 (file)
@@ -94,6 +94,10 @@ static void async_pf_execute(struct work_struct *work)
 
        trace_kvm_async_pf_completed(addr, gva);
 
+       /*
+        * This memory barrier pairs with prepare_to_wait's set_current_state()
+        */
+       smp_mb();
        if (waitqueue_active(&vcpu->wq))
                wake_up_interruptible(&vcpu->wq);