Messages in this thread | | | Date | Thu, 12 May 2022 08:51:36 -0300 | From | Jason Gunthorpe <> | Subject | Re: [PATCH v6 08/12] iommu/sva: Use attach/detach_pasid_dev in SVA interfaces |
| |
On Thu, May 12, 2022 at 11:02:39AM +0800, Baolu Lu wrote: > > > + mutex_lock(&group->mutex); > > > + domain = xa_load(&group->pasid_array, pasid); > > > + if (domain && domain->type != type) > > > + domain = NULL; > > > + mutex_unlock(&group->mutex); > > > + iommu_group_put(group); > > > + > > > + return domain; > > This is bad locking, group->pasid_array values cannot be taken outside > > the lock. > > It's not iommu core, but SVA (or other feature components) that manage > the life cycle of a domain. The iommu core only provides a place to > store the domain pointer. The feature components are free to fetch their > domain pointers from iommu core as long as they are sure that the domain > is alive during use.
I'm not convinced.
Jason
| |