diff options
author | Joerg Roedel <jroedel@suse.de> | 2023-11-27 13:23:54 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2023-11-27 13:23:54 +0300 |
commit | 61f054f3c8a6d6081e078e93aba144760aed17c9 (patch) | |
tree | 3fb922864222d1b35ae23207ad652649ebbb45a4 /drivers/iommu/of_iommu.c | |
parent | 87639e01e05c716d8fd5d63846b6d9a8b0a2e79a (diff) | |
parent | e378c7de74620051c3be899a8c2506c25d23049d (diff) | |
download | linux-61f054f3c8a6d6081e078e93aba144760aed17c9.tar.xz |
Merge branch 'iommu/fixes' into core
Diffstat (limited to 'drivers/iommu/of_iommu.c')
-rw-r--r-- | drivers/iommu/of_iommu.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 5b3631ba5a45..5ecca53847d3 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -112,16 +112,20 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, const u32 *id) { const struct iommu_ops *ops = NULL; - struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); + struct iommu_fwspec *fwspec; int err = NO_IOMMU; if (!master_np) return NULL; + /* Serialise to make dev->iommu stable under our potential fwspec */ + mutex_lock(&iommu_probe_device_lock); + fwspec = dev_iommu_fwspec_get(dev); if (fwspec) { - if (fwspec->ops) + if (fwspec->ops) { + mutex_unlock(&iommu_probe_device_lock); return fwspec->ops; - + } /* In the deferred case, start again from scratch */ iommu_fwspec_free(dev); } @@ -155,6 +159,8 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, fwspec = dev_iommu_fwspec_get(dev); ops = fwspec->ops; } + mutex_unlock(&iommu_probe_device_lock); + /* * If we have reason to believe the IOMMU driver missed the initial * probe for dev, replay it to get things in order. |