From: Jon Pan-Doh Date: Tue, 9 Jul 2024 23:49:13 +0000 (-0700) Subject: iommu/vt-d: Fix identity map bounds in si_domain_init() X-Git-Tag: v6.11-rc1~115^2~7^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31000732d56b43765d51e08cccb68818fbc0032c;p=thirdparty%2Fkernel%2Flinux.git iommu/vt-d: Fix identity map bounds in si_domain_init() Intel IOMMU operates on inclusive bounds (both generally aas well as iommu_domain_identity_map()). Meanwhile, for_each_mem_pfn_range() uses exclusive bounds for end_pfn. This creates an off-by-one error when switching between the two. Fixes: c5395d5c4a82 ("intel-iommu: Clean up iommu_domain_identity_map()") Signed-off-by: Jon Pan-Doh Tested-by: Sudheer Dantuluri Suggested-by: Gary Zibrat Reviewed-by: Lu Baolu Reviewed-by: Kevin Tian Link: https://lore.kernel.org/r/20240709234913.2749386-1-pandoh@google.com Signed-off-by: Will Deacon --- diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 523407f6f6b20..3917279afca7b 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2041,7 +2041,7 @@ static int __init si_domain_init(int hw) for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { ret = iommu_domain_identity_map(si_domain, mm_to_dma_pfn_start(start_pfn), - mm_to_dma_pfn_end(end_pfn)); + mm_to_dma_pfn_end(end_pfn-1)); if (ret) return ret; }