aboutsummaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-08-03 14:57:48 -0300
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-08 20:33:27 -0700
commit4877f4a4c8d80472228e0c843fee5957ae1f94d1 (patch)
treec6c9651bc5c0b05f363d5e6b2b936a5380909428 /virt
parentcbceeda22d9e11693b9ba81b8fd2c78acc87e341 (diff)
KVM: take mmu_lock when updating a deleted slot
(cherry picked from commit b43b1901ad282aeb74161837fb403927102687a1) 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 148982913805..fe0b1eee0898 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1055,8 +1055,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);