Skip to content

Commit

Permalink
iommu/vt-d: Clear pasid table entry when memory unbound
Browse files Browse the repository at this point in the history
In intel_svm_unbind_mm(), pasid table entry must be cleared during
svm free. Otherwise, hardware may be set up with a wild pointer.

Suggested-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
Lu Baolu authored and Alex Williamson committed Nov 3, 2017
1 parent 973b546 commit 4fa064b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/iommu/intel-svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ int intel_svm_unbind_mm(struct device *dev, int pasid)
kfree_rcu(sdev, rcu);

if (list_empty(&svm->devs)) {
svm->iommu->pasid_table[svm->pasid].val = 0;
wmb();

idr_remove(&svm->iommu->pasid_idr, svm->pasid);
if (svm->mm)
Expand Down

0 comments on commit 4fa064b

Please sign in to comment.