]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommupt: Fix short gather if the unmap goes into a large mapping
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 2 Mar 2026 22:22:53 +0000 (18:22 -0400)
committerJoerg Roedel <joerg.roedel@amd.com>
Fri, 27 Mar 2026 08:07:13 +0000 (09:07 +0100)
commitee6e69d032550687a3422504bfca3f834c7b5061
tree23d114a0e6eb2e0f1d61aa7574d40844860df644
parent90c5def10bea574b101b7a520c015ca81742183f
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: 7c53f4238aa8 ("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>
drivers/iommu/generic_pt/iommu_pt.h