> From: Liu, Yi L <yi.l.liu@xxxxxxxxx> > Sent: Wednesday, April 26, 2023 10:54 PM > > +static bool vfio_dev_in_iommufd_ctx(struct vfio_pci_core_device *vdev, > + struct iommufd_ctx *iommufd_ctx) > +{ > + struct iommufd_ctx *iommufd = vfio_iommufd_physical_ictx(&vdev- > >vdev); > + struct iommu_group *iommu_group; > + > + if (!iommufd_ctx) > + return false; > + > + if (iommufd == iommufd_ctx) > + return true; > + > + iommu_group = iommu_group_get(vdev->vdev.dev); > + if (!iommu_group) > + return false; > + > + /* > + * Try to check if any device within iommu_group is bound with > + * the input iommufd_ctx. > + */ > + return vfio_devset_iommufd_has_group(vdev->vdev.dev_set, > + iommufd_ctx, iommu_group); iommu_group is not put.