aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ad36447e696e..86f5bf121838 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1477,7 +1477,7 @@ static int alloc_apic_access_page(struct kvm *kvm)
1477 struct kvm_userspace_memory_region kvm_userspace_mem; 1477 struct kvm_userspace_memory_region kvm_userspace_mem;
1478 int r = 0; 1478 int r = 0;
1479 1479
1480 down_write(&current->mm->mmap_sem); 1480 down_write(&kvm->slots_lock);
1481 if (kvm->arch.apic_access_page) 1481 if (kvm->arch.apic_access_page)
1482 goto out; 1482 goto out;
1483 kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; 1483 kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT;
@@ -1487,9 +1487,12 @@ static int alloc_apic_access_page(struct kvm *kvm)
1487 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0); 1487 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
1488 if (r) 1488 if (r)
1489 goto out; 1489 goto out;
1490
1491 down_read(&current->mm->mmap_sem);
1490 kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00); 1492 kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00);
1493 up_read(&current->mm->mmap_sem);
1491out: 1494out:
1492 up_write(&current->mm->mmap_sem); 1495 up_write(&kvm->slots_lock);
1493 return r; 1496 return r;
1494} 1497}
1495 1498