aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-09-17 22:23:25 -0700
committerYinghai Lu <yinghai@kernel.org>2012-09-17 22:23:25 -0700
commitb8b76fbdbd598914cf9cea433042d3b2e09809d6 (patch)
treeb3b929d33f78c460fe38eba00739db624b3972e3
parent54d0a4f446535c60e53e05ad23c09fcee08ad581 (diff)
downloadlinux-yinghai-b8b76fbdbd598914cf9cea433042d3b2e09809d6.tar.gz
IOMMU: Fix tboot force iommu logic
Should check dmar_disabled just after tboot_force_iommu. Otherwise when tboot is not used, and intel_iommu=off, and nointrmap still get dmar_table_init() called. that will cause some get_device calling, and it will have some device refcount leaking. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: iommu@lists.linux-foundation.org
-rw-r--r--drivers/iommu/intel-iommu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 9f5a8f3f088cfe..3c0ce37f119138 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3641,6 +3641,9 @@ int __init intel_iommu_init(void)
/* VT-d is required for a TXT/tboot launch, so enforce that */
force_on = tboot_force_iommu();
+ if (no_iommu || dmar_disabled)
+ return -ENODEV;
+
if (dmar_table_init()) {
if (force_on)
panic("tboot: Failed to initialize DMAR table\n");
@@ -3653,9 +3656,6 @@ int __init intel_iommu_init(void)
return -ENODEV;
}
- if (no_iommu || dmar_disabled)
- return -ENODEV;
-
if (iommu_init_mempool()) {
if (force_on)
panic("tboot: Failed to initialize iommu memory\n");