]> git.itanic.dy.fi Git - linux-stable/commit
iommu/vt-d: Fix possible recursive locking in intel_iommu_init()
authorLu Baolu <baolu.lu@linux.intel.com>
Sun, 11 Sep 2022 03:18:45 +0000 (11:18 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2022 08:47:19 +0000 (10:47 +0200)
commit9516acba29e322202674d18f4dc383879f7813a5
tree825ed606459a51710eea099ee30c1564f4b39efd
parent53b284a895f020c24a33181c0a7726547ae1e678
iommu/vt-d: Fix possible recursive locking in intel_iommu_init()

[ Upstream commit 9cd4f1434479f1ac25c440c421fbf52069079914 ]

The global rwsem dmar_global_lock was introduced by commit 3a5670e8ac932
("iommu/vt-d: Introduce a rwsem to protect global data structures"). It
is used to protect DMAR related global data from DMAR hotplug operations.

The dmar_global_lock used in the intel_iommu_init() might cause recursive
locking issue, for example, intel_iommu_get_resv_regions() is taking the
dmar_global_lock from within a section where intel_iommu_init() already
holds it via probe_acpi_namespace_devices().

Using dmar_global_lock in intel_iommu_init() could be relaxed since it is
unlikely that any IO board must be hot added before the IOMMU subsystem is
initialized. This eliminates the possible recursive locking issue by moving
down DMAR hotplug support after the IOMMU is initialized and removing the
uses of dmar_global_lock in intel_iommu_init().

Fixes: d5692d4af08cd ("iommu/vt-d: Fix suspicious RCU usage in probe_acpi_namespace_devices()")
Reported-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/894db0ccae854b35c73814485569b634237b5538.1657034828.git.robin.murphy@arm.com
Link: https://lore.kernel.org/r/20220718235325.3952426-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/intel/dmar.c
drivers/iommu/intel/iommu.c
include/linux/dmar.h