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