Re: [PATCH RFC v2 1/4] iommu: Lock group->mutex in iommu_deferred_attach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux