From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yinghai Lu Subject: [PATCH -v3 03/47] IOMMU: Fix tboot force iommu logic Date: Sun, 18 Mar 2012 22:45:52 -0700 Message-ID: <1332135996-13860-4-git-send-email-yinghai@kernel.org> References: <1332135996-13860-1-git-send-email-yinghai@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1332135996-13860-1-git-send-email-yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Jesse Barnes , x86 Cc: Greg Kroah-Hartman , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Yinghai Lu , linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Bjorn Helgaas , Andrew Morton , Linus Torvalds , David Woodhouse List-Id: iommu@lists.linux-foundation.org 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 Cc: David Woodhouse Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org --- drivers/iommu/intel-iommu.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 49eb412..7c71a3a 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -3768,6 +3768,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"); @@ -3780,9 +3783,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"); -- 1.7.7