iommu: Mark dev_iommu_get() with lockdep
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 7 Dec 2023 18:03:11 +0000 (14:03 -0400)
committerJoerg Roedel <jroedel@suse.de>
Tue, 12 Dec 2023 09:18:48 +0000 (10:18 +0100)
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>
Tested-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Moritz Fischer <moritzf@google.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/4-v2-16e4def25ebb+820-iommu_fwspec_p1_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c

index d0a28667479a82bf8eb4f3d9db35e9422ff51a09..df58025c001b332db8117582de360d80fa42f3f5 100644 (file)
@@ -334,6 +334,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;