mbox series

[V3,0/2] iommu/arm-smmu: Fix races in iommu domain/group creation

Message ID 1628570641-9127-1-git-send-email-amhetre@nvidia.com (mailing list archive)
Headers show
Series iommu/arm-smmu: Fix races in iommu domain/group creation | expand

Message

Ashish Mhetre Aug. 10, 2021, 4:43 a.m. UTC
When two devices with same SID are getting probed concurrently through
iommu_probe_device(), the iommu_group and iommu_domain are allocated more
than once because they are not protected for concurrency. This is leading
to context faults when one device is accessing IOVA from other device.
Fix this by protecting iommu_domain and iommu_group creation with mutexes.

Changes in v3:
* Updated commit messages.
* Added Signed-off-by in patch 2.

Ashish Mhetre (1):
  iommu: Fix race condition during default domain allocation

Krishna Reddy (1):
  iommu/arm-smmu: Fix race condition during iommu_group creation

 drivers/iommu/arm/arm-smmu/arm-smmu.c | 6 +++++-
 drivers/iommu/iommu.c                 | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Will Deacon Aug. 10, 2021, 8:25 p.m. UTC | #1
On Tue, 10 Aug 2021 10:13:59 +0530, Ashish Mhetre wrote:
> When two devices with same SID are getting probed concurrently through
> iommu_probe_device(), the iommu_group and iommu_domain are allocated more
> than once because they are not protected for concurrency. This is leading
> to context faults when one device is accessing IOVA from other device.
> Fix this by protecting iommu_domain and iommu_group creation with mutexes.
> 
> Changes in v3:
> * Updated commit messages.
> * Added Signed-off-by in patch 2.
> 
> [...]

Applied to will (for-joerg/arm-smmu/updates), thanks!

[1/2] iommu: Fix race condition during default domain allocation
      https://git.kernel.org/will/c/211ff31b3d33
[2/2] iommu/arm-smmu: Fix race condition during iommu_group creation
      https://git.kernel.org/will/c/b1a1347912a7

Cheers,