]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommu: Avoid introducing more races
authorRobin Murphy <robin.murphy@arm.com>
Tue, 11 Mar 2025 15:19:25 +0000 (15:19 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:46:27 +0000 (14:46 +0200)
commit9eff7605ebccdba7b3d83bbe9043bb9c14fedb13
treeb3a71df0d657f5f7809ec1f6fbdcbb6314e1c6da
parent25f950dc53fe242d39980862d071a7b2a0134682
iommu: Avoid introducing more races

commit 0c8e9c148e29a983e67060fb4944a8ca79d4362a upstream.

Although the lock-juggling is only a temporary workaround, we don't want
it to make things avoidably worse. Jason was right to be nervous, since
bus_iommu_probe() doesn't care *which* IOMMU instance it's probing for,
so it probably is possible for one walk to finish a probe which a
different walk started, thus we do want to check for that.

Also there's no need to drop the lock just to have of_iommu_configure()
do nothing when a fwspec already exists; check that directly and avoid
opening a window at all in that (still somewhat likely) case.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/09d901ad11b3a410fbb6e27f7d04ad4609c3fe4a.1741706365.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/iommu.c