diff options
author | Mark McLoughlin <markmc@redhat.com> | 2009-02-05 18:23:46 +0000 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-02-15 02:47:39 +0200 |
commit | 682edb4c01e690c7c7cd772dbd6f4e0fd74dc572 (patch) | |
tree | 21e41d8f67f3fc81df9744e91350e76b1787ec3b /virt/kvm/iommu.c | |
parent | b682b814e3cc340f905c14dff87ce8bdba7c5eba (diff) | |
download | linux-stable-682edb4c01e690c7c7cd772dbd6f4e0fd74dc572.tar.gz linux-stable-682edb4c01e690c7c7cd772dbd6f4e0fd74dc572.tar.bz2 linux-stable-682edb4c01e690c7c7cd772dbd6f4e0fd74dc572.zip |
KVM: Fix assigned devices circular locking dependency
kvm->slots_lock is outer to kvm->lock, so take slots_lock
in kvm_vm_ioctl_assign_device() before taking kvm->lock,
rather than taking it in kvm_iommu_map_memslots().
Cc: stable@kernel.org
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/iommu.c')
-rw-r--r-- | virt/kvm/iommu.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index e9693a29d00e..4c4037503600 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -73,14 +73,13 @@ static int kvm_iommu_map_memslots(struct kvm *kvm) { int i, r = 0; - down_read(&kvm->slots_lock); for (i = 0; i < kvm->nmemslots; i++) { r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, kvm->memslots[i].npages); if (r) break; } - up_read(&kvm->slots_lock); + return r; } @@ -190,12 +189,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm, static int kvm_iommu_unmap_memslots(struct kvm *kvm) { int i; - down_read(&kvm->slots_lock); + for (i = 0; i < kvm->nmemslots; i++) { kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, kvm->memslots[i].npages); } - up_read(&kvm->slots_lock); return 0; } |