iommu/dma: Do not try to iommu_map a 0 length region in swiotlb
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.18.367.0.137.1In the Linux kernel, the following vulnerability has been resolved:
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.
From the CVE record · Linux
The Linux kernel can attempt to map a zero-length region when forced SWIOTLB handles an unaligned DMA mapping. The failed mapping can corrupt mapping state during error cleanup and trigger a WARN_ON when the mapping is destroyed. The condition is frequently triggered by smartctl passthrough commands to some Thunderbolt NVMe drives; the input does not establish a network attack path or authentication requirement.
Engineers running Linux kernels with IOMMU DMA and forced SWIOTLB, particularly with affected Thunderbolt NVMe drives, should check whether their kernel includes the fix; affected versions were not provided.