diff options
| author | Jason Gunthorpe <jgg@nvidia.com> | 2026-06-08 15:10:04 -0300 |
|---|---|---|
| committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2026-06-09 22:23:42 +0200 |
| commit | 6ec91df8aff77e2e8fe3179c1f3fc15b43a40ba3 (patch) | |
| tree | 723138071ad58605d0727d924665e7f3867ca54a /Documentation/arm64/git@git.tavy.me:linux.git | |
| parent | 9bfaa86b405381326c971984fd6da184c289713f (diff) | |
iommu/dma: Do not try to iommu_map a 0 length region in swiotlb
iommu_dma_iova_link_swiotlb() processes a mapping that is unaligned in three
parts, the head, middle and trailer. If the middle is empty because there
are no aligned pages it will call down to iommu_map() with a 0 size
which the iommupt implementation will fail as illegal.
It then tries to do an error unwind and starts from the wrong spot
corrupting the mapping so the eventual destruction triggers a WARN_ON.
Check for 0 length and avoid mapping and use offset not 0 as the starting
point to unlink.
This is frequently triggered by using some kinds of thunderbolt NVMe
drives that trigger forced SWIOTLB for unaligned memory. NVMe seems to
pass in oddly aligned buffers for the passthrough commands from smartctl
that hit this condition.
Cc: stable@vger.kernel.org
Fixes: 433a76207dcf ("dma-mapping: Implement link/unlink ranges API")
Reported-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/0-v1-8536728bc89f+469-swiotlb_warn_jgg@nvidia.com
Diffstat (limited to 'Documentation/arm64/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
