From: Herongguang (Stephen) Date: Mon, 27 Mar 2017 07:21:17 +0000 (+0800) Subject: KVM: pci-assign: do not map smm memory slot pages in vt-d page tables X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0292e169b2d9c8377a168778f0b16eadb1f578fd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git KVM: pci-assign: do not map smm memory slot pages in vt-d page tables or VM memory are not put thus leaked in kvm_iommu_unmap_memslots() when destroy VM. This is consistent with current vfio implementation. Signed-off-by: herongguang Signed-off-by: Paolo Bonzini --- diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index ef1aa7f1ed7a..88257b311cb5 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1065,7 +1065,7 @@ int __kvm_set_memory_region(struct kvm *kvm, * changes) is disallowed above, so any other attribute changes getting * here can be skipped. */ - if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { + if (as_id == 0 && (change == KVM_MR_CREATE || change == KVM_MR_MOVE)) { r = kvm_iommu_map_pages(kvm, &new); return r; }