diff mbox series

[v2,16/17] iommu: Mark dev_iommu_get() with lockdep

Message ID 16-v2-36a0088ecaa7+22c6e-iommu_fwspec_jgg@nvidia.com (mailing list archive)
State Handled Elsewhere
Headers show
Series Solve iommu probe races around iommu_fwspec | expand

Checks

Context Check Description
conchuod/vmtest-fixes-PR fail merge-conflict
conchuod/vmtest-for-next-PR fail PR summary
conchuod/patch-16-test-1 success .github/scripts/patches/build_rv32_defconfig.sh
conchuod/patch-16-test-2 success .github/scripts/patches/build_rv64_clang_allmodconfig.sh
conchuod/patch-16-test-3 success .github/scripts/patches/build_rv64_gcc_allmodconfig.sh
conchuod/patch-16-test-4 success .github/scripts/patches/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-16-test-5 success .github/scripts/patches/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-16-test-6 success .github/scripts/patches/checkpatch.sh
conchuod/patch-16-test-7 success .github/scripts/patches/dtb_warn_rv64.sh
conchuod/patch-16-test-8 success .github/scripts/patches/header_inline.sh
conchuod/patch-16-test-9 success .github/scripts/patches/kdoc.sh
conchuod/patch-16-test-10 success .github/scripts/patches/module_param.sh
conchuod/patch-16-test-11 success .github/scripts/patches/verify_fixes.sh
conchuod/patch-16-test-12 success .github/scripts/patches/verify_signedoff.sh

Commit Message

Jason Gunthorpe Nov. 15, 2023, 2:06 p.m. UTC
Allocation of dev->iommu must be done under the
iommu_probe_device_lock. Mark this with lockdep to discourage future
mistakes.

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/iommu.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index de6dcb244bff4a..34c4b07a6aafae 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -345,6 +345,8 @@  static struct dev_iommu *dev_iommu_get(struct device *dev)
 {
 	struct dev_iommu *param = dev->iommu;
 
+	lockdep_assert_held(&iommu_probe_device_lock);
+
 	if (param)
 		return param;