summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Pan <jacob.pan@linux.microsoft.com>2026-02-13 21:36:36 +0300
committerJason Gunthorpe <jgg@nvidia.com>2026-03-03 03:29:01 +0300
commit7147ec874ea08c322d779d8eba28946e294ed1f3 (patch)
tree35de3a82b72b0bb2973dedfa176ebac4f53cc2d7
parent46a93917bf776c35dfdfe7601f8972dacd9259ee (diff)
downloadlinux-7147ec874ea08c322d779d8eba28946e294ed1f3.tar.xz
iommufd: vfio compatibility extension check for noiommu mode
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: d624d6652a65 ("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>
-rw-r--r--drivers/iommu/iommufd/vfio_compat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/iommufd/vfio_compat.c b/drivers/iommu/iommufd/vfio_compat.c
index a258ee2f4579..acb48cdd3b00 100644
--- a/drivers/iommu/iommufd/vfio_compat.c
+++ b/drivers/iommu/iommufd/vfio_compat.c
@@ -283,7 +283,7 @@ static int iommufd_vfio_check_extension(struct iommufd_ctx *ictx,
case VFIO_TYPE1_IOMMU:
case VFIO_TYPE1v2_IOMMU:
case VFIO_UNMAP_ALL:
- return 1;
+ return !ictx->no_iommu_mode;
case VFIO_NOIOMMU_IOMMU:
return IS_ENABLED(CONFIG_VFIO_NOIOMMU);