From: Avi Kivity Date: Wed, 27 Aug 2008 13:32:24 +0000 (+0300) Subject: KVM: MMU: Add locking around kvm_mmu_slot_remove_write_access() X-Git-Tag: v2.6.28-rc1~269^2~61 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=2245a28fe2e6fdb1bdabc4dcde1ea3a5c37e2a9e;p=linux-2.6-omap-h63xx.git KVM: MMU: Add locking around kvm_mmu_slot_remove_write_access() It was generally safe due to slots_lock being held for write, but it wasn't very nice. Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index a24da8f2ee9..5052acdc0a7 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2097,6 +2097,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) { struct kvm_mmu_page *sp; + spin_lock(&kvm->mmu_lock); list_for_each_entry(sp, &kvm->arch.active_mmu_pages, link) { int i; u64 *pt; @@ -2110,6 +2111,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) if (pt[i] & PT_WRITABLE_MASK) pt[i] &= ~PT_WRITABLE_MASK; } + spin_unlock(&kvm->mmu_lock); } void kvm_mmu_zap_all(struct kvm *kvm)