Skip to content

Commit a21518c

Browse files
Fenghua Yujoergroedel
authored andcommitted
iommu/vt-d: Fix PASID leak in intel_svm_unbind_mm()
The 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. Fixes: 4048377 ("iommu/vt-d: Use iommu_sva_alloc(free)_pasid() helpers") Reported-and-tested-by: Dave Jiang <[email protected]> Co-developed-by: Jacob Pan <[email protected]> Signed-off-by: Jacob Pan <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent eb03f2d commit a21518c

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

drivers/iommu/intel/svm.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,6 @@ static void load_pasid(struct mm_struct *mm, u32 pasid)
514514
{
515515
mutex_lock(&mm->context.lock);
516516

517-
/* Synchronize with READ_ONCE in update_pasid(). */
518-
smp_store_release(&mm->pasid, pasid);
519-
520517
/* Update PASID MSR on all CPUs running the mm's tasks. */
521518
on_each_cpu_mask(mm_cpumask(mm), _load_pasid, NULL, true);
522519

0 commit comments

Comments
 (0)