Re: [PATCH v5 12/19] vfio-iommufd: Add detach_ioas for emulated VFIO devices

Jason Gunthorpe
2023-02-27T18:45:28Z

On Mon, Feb 27, 2023 at 03:11:28AM -0800, Yi Liu wrote:
> diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
> index bfaa9876499b..faf2516b0f06 100644
> --- a/drivers/vfio/iommufd.c
> +++ b/drivers/vfio/iommufd.c
> @@ -165,6 +165,12 @@ int vfio_iommufd_emulated_attach_ioas(struct vfio_device *vdev, u32 *pt_id)
>
> lockdep_assert_held(&vdev->dev_set->lock);
>
> + if (!vdev->iommufd_ictx)
> + return -EINVAL;

Same remark about WARN_ON here too

Jason