KVM: take srcu lock before call to complete_pio()
authorGleb Natapov <gleb@redhat.com>
Tue, 9 Mar 2010 10:01:10 +0000 (12:01 +0200)
committerAvi Kivity <avi@redhat.com>
Tue, 20 Apr 2010 09:55:04 +0000 (12:55 +0300)
complete_pio() may use slot table which is protected by srcu.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index 24cd0ee..2eb999d 100644 (file)
@@ -4483,7 +4483,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
                kvm_set_cr8(vcpu, kvm_run->cr8);
 
        if (vcpu->arch.pio.cur_count) {
+               vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
                r = complete_pio(vcpu);
+               srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
                if (r)
                        goto out;
        }