All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "iommu/vt-d: Fix dead-locks in disable_dmar_iommu() path" has been added to the 4.8-stable tree
@ 2016-11-17  8:17 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-11-17  8:17 UTC (permalink / raw)
  To: jroedel, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    iommu/vt-d: Fix dead-locks in disable_dmar_iommu() path

to the 4.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-vt-d-fix-dead-locks-in-disable_dmar_iommu-path.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From bea64033dd7b5fb6296eda8266acab6364ce1554 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <jroedel@suse.de>
Date: Tue, 8 Nov 2016 15:08:26 +0100
Subject: iommu/vt-d: Fix dead-locks in disable_dmar_iommu() path

From: Joerg Roedel <jroedel@suse.de>

commit bea64033dd7b5fb6296eda8266acab6364ce1554 upstream.

It turns out that the disable_dmar_iommu() code-path tried
to get the device_domain_lock recursivly, which will
dead-lock when this code runs on dmar removal. Fix both
code-paths that could lead to the dead-lock.

Fixes: 55d940430ab9 ('iommu/vt-d: Get rid of domain->iommu_lock')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/intel-iommu.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1711,6 +1711,7 @@ static void disable_dmar_iommu(struct in
 	if (!iommu->domains || !iommu->domain_ids)
 		return;
 
+again:
 	spin_lock_irqsave(&device_domain_lock, flags);
 	list_for_each_entry_safe(info, tmp, &device_domain_list, global) {
 		struct dmar_domain *domain;
@@ -1723,10 +1724,19 @@ static void disable_dmar_iommu(struct in
 
 		domain = info->domain;
 
-		dmar_remove_one_dev_info(domain, info->dev);
+		__dmar_remove_one_dev_info(info);
 
-		if (!domain_type_is_vm_or_si(domain))
+		if (!domain_type_is_vm_or_si(domain)) {
+			/*
+			 * The domain_exit() function  can't be called under
+			 * device_domain_lock, as it takes this lock itself.
+			 * So release the lock here and re-run the loop
+			 * afterwards.
+			 */
+			spin_unlock_irqrestore(&device_domain_lock, flags);
 			domain_exit(domain);
+			goto again;
+		}
 	}
 	spin_unlock_irqrestore(&device_domain_lock, flags);
 


Patches currently in stable-queue which might be from jroedel@suse.de are

queue-4.8/iommu-amd-free-domain-id-when-free-a-domain-of-struct-dma_ops_domain.patch
queue-4.8/iommu-vt-d-fix-dead-locks-in-disable_dmar_iommu-path.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-17  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-17  8:17 Patch "iommu/vt-d: Fix dead-locks in disable_dmar_iommu() path" has been added to the 4.8-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.