On Sat, Jun 28, 2025 at 12:42:39AM -0700, Nicolin Chen wrote: > The iommu_deferred_attach() is a runtime asynchronous function called by > iommu-dma function, which will race against other attach functions if it > accesses something in the dev->iommu_group. > > Grab the lock to protect it like others who call __iommu_attach_device() > as it will need to access dev->iommu_group. > > Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx> > --- > drivers/iommu/iommu.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) I vaugely recall seeing something like this before. IIRC it can't actually race but there is no harm in taking the lock so lockdep works reliably. It isn't fast path. Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason