Skip to content

Commit ee6e69d

Browse files
jgunthorpejoergroedel
authored andcommitted
iommupt: Fix short gather if the unmap goes into a large mapping
unmap has the odd behavior that it can unmap more than requested if the ending point lands within the middle of a large or contiguous IOPTE. In this case the gather should flush everything unmapped which can be larger than what was requested to be unmapped. The gather was only flushing the range requested to be unmapped, not extending to the extra range, resulting in a short invalidation if the caller hits this special condition. This was found by the new invalidation/gather test I am adding in preparation for ARMv8. Claude deduced the root cause. As far as I remember nothing relies on unmapping a large entry, so this is likely not a triggerable bug. Cc: stable@vger.kernel.org Fixes: 7c53f42 ("iommupt: Add unmap_pages op") Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Samiullah Khawaja <skhawaja@google.com> Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent 90c5def commit ee6e69d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/iommu/generic_pt/iommu_pt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ size_t DOMAIN_NS(unmap_pages)(struct iommu_domain *domain, unsigned long iova,
10571057

10581058
pt_walk_range(&range, __unmap_range, &unmap);
10591059

1060-
gather_range_pages(iotlb_gather, iommu_table, iova, len,
1060+
gather_range_pages(iotlb_gather, iommu_table, iova, unmap.unmapped,
10611061
&unmap.free_list);
10621062

10631063
return unmap.unmapped;

0 commit comments

Comments
 (0)