summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorAlex Mastro <amastro@fb.com>2026-03-03 22:46:24 +0300
committerAlex Williamson <alex@shazbot.org>2026-03-10 20:56:01 +0300
commitf183963891b4b0126f19aa0993ed931f3f3f9520 (patch)
tree20342d7600ff00bbacd15a175bd0ed66ecf23840 /tools/testing
parentaef50ed5b23918345478adf5224a059dfff87df1 (diff)
downloadlinux-f183963891b4b0126f19aa0993ed931f3f3f9520.tar.xz
vfio: selftests: fix crash in vfio_dma_mapping_mmio_test
Remove the __iommu_unmap() call on a region that was never mapped. When __iommu_map() fails (expected for MMIO vaddrs in non-VFIO modes), the region is not added to the dma_regions list, leaving its list_head zero-initialized. If the unmap ioctl returns success, __iommu_unmap() calls list_del_init() on this zeroed node and crashes. This fixes the iommufd_compat_type1 and iommufd_compat_type1v2 test variants. Fixes: 080723f4d4c3 ("vfio: selftests: Add vfio_dma_mapping_mmio_test") Signed-off-by: Alex Mastro <amastro@fb.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Yuan Yao <yaoyuan@linux.alibaba.com> Link: https://lore.kernel.org/r/20260303-fix-mmio-test-v1-1-78b4a9e46a4e@fb.com Signed-off-by: Alex Williamson <alex@shazbot.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/vfio/vfio_dma_mapping_mmio_test.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_mmio_test.c b/tools/testing/selftests/vfio/vfio_dma_mapping_mmio_test.c
index 957a89ce7b3a..d7f25ef77671 100644
--- a/tools/testing/selftests/vfio/vfio_dma_mapping_mmio_test.c
+++ b/tools/testing/selftests/vfio/vfio_dma_mapping_mmio_test.c
@@ -100,7 +100,6 @@ static void do_mmio_map_test(struct iommu *iommu,
iommu_unmap(iommu, &region);
} else {
VFIO_ASSERT_NE(__iommu_map(iommu, &region), 0);
- VFIO_ASSERT_NE(__iommu_unmap(iommu, &region, NULL), 0);
}
}