Skip to content

Commit 2e7a522

Browse files
jacobpangregkh
authored andcommitted
iommufd: vfio compatibility extension check for noiommu mode
[ Upstream commit 7147ec8 ] VFIO_CHECK_EXTENSION should return false for TYPE1_IOMMU variants when in NO-IOMMU mode and IOMMUFD compat container is set. This change makes the behavior match VFIO_CONTAINER in noiommu mode. It also prevents userspace from incorrectly attempting to use TYPE1 IOMMU operations in a no-iommu context. Fixes: d624d66 ("iommufd: vfio container FD ioctl compatibility") Link: https://patch.msgid.link/r/20260213183636.3340-1-jacob.pan@linux.microsoft.com Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d8877de commit 2e7a522

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/iommu/iommufd/vfio_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static int iommufd_vfio_check_extension(struct iommufd_ctx *ictx,
283283
case VFIO_TYPE1_IOMMU:
284284
case VFIO_TYPE1v2_IOMMU:
285285
case VFIO_UNMAP_ALL:
286-
return 1;
286+
return !ictx->no_iommu_mode;
287287

288288
case VFIO_NOIOMMU_IOMMU:
289289
return IS_ENABLED(CONFIG_VFIO_NOIOMMU);

0 commit comments

Comments
 (0)