[patch 19/71] KVM: take mmu_lock when updating a deleted slot
From: Greg KH
Date: Fri Sep 04 2009 - 20:31:21 EST
2.6.30-stable review patch. If anyone has any objections, please let us know.
------------------
From: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
(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@xxxxxxxxxx>
Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
virt/kvm/kvm_main.c | 2 ++
1 file changed, 2 insertions(+)
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1055,8 +1055,10 @@ int __kvm_set_memory_region(struct 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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/