On Thu, Jun 06, 2024 at 01:33:29PM +0800, Baolu Lu wrote: > > But if certain path (other than iopf) in the iommu core needs to know > > the exact domain pointer then this change breaks it. > > The iommu core should not fetch the domain pointer in paths other than > attach/detach/replace. There is currently no reference counter for an > iommu domain, hence fetching the domain for other purposes will > potentially lead to a use-after-free issue. If you are doing this then we should get rid of iommu_get_domain_for_dev_pasid, and always return the handle there. Making it clear that all those flows require handles to work. But is this really OK? What happened to the patch fixing the error unwind in attach_pasid? Doesn't it always need the domain to undo a failed attach? Jason