All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iommu/vt-d: Fix PASID leak
@ 2021-08-26 21:59 Fenghua Yu
  2021-08-26 21:59 ` [PATCH 2/2] iommu/vt-d: Fix a deadlock in SVM Fenghua Yu
  2021-08-27 12:24 ` [PATCH 1/2] iommu/vt-d: Fix PASID leak Lu Baolu
  0 siblings, 2 replies; 4+ messages in thread
From: Fenghua Yu @ 2021-08-26 21:59 UTC (permalink / raw)
  To: Lu Baolu, David Woodhouse, Jacob Jun Pan, Dave Jiang, Ashok Raj,
	Ravi V Shankar
  Cc: Fenghua Yu, iommu

mm->pasid will be used in intel_svm_free_pasid() after load_pasid()
during unbinding mm. Clearing it in load_pasid() will cause PASID cannot
be freed in intel_svm_free_pasid().

Additionally mm->pasid was updated already before load_pasid() during pasid
allocation. No need to update it again in load_pasid() during binding mm.

Don't update mm->pasid to avoid the issues in both binding mm and
unbinding mm.

Please note that load_pasid() and its called functions will be re-written
in upcoming re-enabling ENQCMD series. This patch tries to fix the issues
cleanly before the re-enabling ENQCMD series.

Fixes: 62ef907a045e ("iommu/vt-d: Fix PASID reference leak")

Reported-and-tested-by: Dave Jiang <dave.jiang@intel.com>
Co-developed-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
 drivers/iommu/intel/svm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index 4b9b3f35ba0e..ceeca633a5f9 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -516,9 +516,6 @@ static void load_pasid(struct mm_struct *mm, u32 pasid)
 {
 	mutex_lock(&mm->context.lock);
 
-	/* Synchronize with READ_ONCE in update_pasid(). */
-	smp_store_release(&mm->pasid, pasid);
-
 	/* Update PASID MSR on all CPUs running the mm's tasks. */
 	on_each_cpu_mask(mm_cpumask(mm), _load_pasid, NULL, true);
 
-- 
2.33.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-27 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 21:59 [PATCH 1/2] iommu/vt-d: Fix PASID leak Fenghua Yu
2021-08-26 21:59 ` [PATCH 2/2] iommu/vt-d: Fix a deadlock in SVM Fenghua Yu
2021-08-27 12:04   ` Lu Baolu
2021-08-27 12:24 ` [PATCH 1/2] iommu/vt-d: Fix PASID leak Lu Baolu

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.