aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/iommu/amd_iommu_v2.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index a195c78b63c6..2b7de882e91c 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -320,13 +320,6 @@ static void unbind_pasid(struct pasid_state *pasid_state)
320 320
321 /* Make sure no more pending faults are in the queue */ 321 /* Make sure no more pending faults are in the queue */
322 flush_workqueue(iommu_wq); 322 flush_workqueue(iommu_wq);
323
324 /*
325 * No more faults are in the work queue and no new faults will be queued
326 * from here on. We can safely set pasid_state->mm to NULL now as the
327 * mm_struct might go away after we return.
328 */
329 pasid_state->mm = NULL;
330} 323}
331 324
332static void free_pasid_states_level1(struct pasid_state **tbl) 325static void free_pasid_states_level1(struct pasid_state **tbl)
@@ -756,17 +749,10 @@ void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid)
756 clear_pasid_state(dev_state, pasid_state->pasid); 749 clear_pasid_state(dev_state, pasid_state->pasid);
757 750
758 /* 751 /*
759 * Check if pasid_state->mm is still valid. If mn_release has already 752 * Call mmu_notifier_unregister to drop our reference
760 * run it will be NULL and we can't (and don't need to) call 753 * to pasid_state->mm
761 * mmu_notifier_unregister() on it anymore.
762 */ 754 */
763 if (pasid_state->mm) { 755 mmu_notifier_unregister(&pasid_state->mn, pasid_state->mm);
764 /*
765 * This will call the mn_release function and unbind
766 * the PASID.
767 */
768 mmu_notifier_unregister(&pasid_state->mn, pasid_state->mm);
769 }
770 756
771 put_pasid_state_wait(pasid_state); /* Reference taken in 757 put_pasid_state_wait(pasid_state); /* Reference taken in
772 amd_iommu_pasid_bind */ 758 amd_iommu_pasid_bind */