diff options
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 42b73930a6de..9739b533ca2e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -808,12 +808,13 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
808 | if (r) | 808 | if (r) |
809 | goto out_free; | 809 | goto out_free; |
810 | 810 | ||
811 | /* map the pages in iommu page table */ | 811 | /* map/unmap the pages in iommu page table */ |
812 | if (npages) { | 812 | if (npages) { |
813 | r = kvm_iommu_map_pages(kvm, &new); | 813 | r = kvm_iommu_map_pages(kvm, &new); |
814 | if (r) | 814 | if (r) |
815 | goto out_free; | 815 | goto out_free; |
816 | } | 816 | } else |
817 | kvm_iommu_unmap_pages(kvm, &old); | ||
817 | 818 | ||
818 | r = -ENOMEM; | 819 | r = -ENOMEM; |
819 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), | 820 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), |