Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
[sfrench/cifs-2.6.git] / virt / kvm / arm / mmu.c
index ad90ea3e5558a0911bf7602d67c2a16e6a7305f8..74b6582eaa3cffe8c19dcd5935811cb457a8dc10 100644 (file)
@@ -1781,8 +1781,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
                 * Only PMD_SIZE transparent hugepages(THP) are
                 * currently supported. This code will need to be
                 * updated to support other THP sizes.
+                *
+                * Make sure the host VA and the guest IPA are sufficiently
+                * aligned and that the block is contained within the memslot.
                 */
-               if (transparent_hugepage_adjust(&pfn, &fault_ipa))
+               if (fault_supports_stage2_huge_mapping(memslot, hva, PMD_SIZE) &&
+                   transparent_hugepage_adjust(&pfn, &fault_ipa))
                        vma_pagesize = PMD_SIZE;
        }