diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-05-12 18:55:44 -0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-05-13 10:39:40 +0300 |
commit | cbb776efc4c8aeeb0a584784d829cbb41983802c (patch) | |
tree | 976e6763bb95e58c7757ac3be33b6ec96e5f6f3c /virt | |
parent | aabfbc8c58bc70a7178b58c4e94722140337247b (diff) |
KVM: take mmu_lock when updating a deleted slot
kvm_handle_hva relies on mmu_lock protection to safely access
the memslot structures.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 4d00942e5d0a..bebfe59f4c76 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1210,8 +1210,10 @@ int __kvm_set_memory_region(struct kvm *kvm, kvm_free_physmem_slot(&old, npages ? &new : NULL); /* Slot deletion case: we have to update the current slot */ + spin_lock(&kvm->mmu_lock); if (!npages) *memslot = old; + spin_unlock(&kvm->mmu_lock); #ifdef CONFIG_DMAR /* map the pages in iommu page table */ r = kvm_iommu_map_pages(kvm, base_gfn, npages); |