iommu/amd: Limit the IOVA page range to the specified addresses
authorGary R Hook <gary.hook@amd.com>
Fri, 3 Nov 2017 16:50:34 +0000 (10:50 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Fri, 3 Nov 2017 16:50:34 +0000 (10:50 -0600)
The extent of pages specified when applying a reserved region should
include up to the last page of the range, but not the page following
the range.

Signed-off-by: Gary R Hook <gary.hook@amd.com>
Fixes: 8d54d6c8b8f3 ('iommu/amd: Implement apply_dm_region call-back')
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/iommu/amd_iommu.c

index 797e6454afd5c7c06efc161e5d21202fde1e92aa..a8c111e96cc38185c57a6f522a5d6f19351f46af 100644 (file)
@@ -3151,7 +3151,7 @@ static void amd_iommu_apply_resv_region(struct device *dev,
        unsigned long start, end;
 
        start = IOVA_PFN(region->start);
-       end   = IOVA_PFN(region->start + region->length);
+       end   = IOVA_PFN(region->start + region->length - 1);
 
        WARN_ON_ONCE(reserve_iova(&dma_dom->iovad, start, end) == NULL);
 }