summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-06-22 22:50:56 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-06-22 22:50:56 +0000
commita6c5856adad51df497f6e27fbea3ac847904b751 (patch)
tree73d549cdf0788e8d1dd27e11c3fa9fd54a33416e /sys/dev/pci/drm/amd/amdkfd/kfd_svm.c
parenta20552fa25eef069b6a3cc82f17856da7ad398dd (diff)
drm/amdkfd: Use mmget_not_zero in MMU notifier
From Philip Yang 09c5cdbc62d99fc6306a21b24b60eb11a3bd0963 in linux 5.15.y/5.15.49 fa582c6f3684ac0098a9d02ddf0ed52a02b37127 in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/amd/amdkfd/kfd_svm.c')
-rw-r--r--sys/dev/pci/drm/amd/amdkfd/kfd_svm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c b/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c
index 830809b694d..74e6f613be0 100644
--- a/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c
+++ b/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c
@@ -2181,6 +2181,8 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,
if (range->event == MMU_NOTIFY_RELEASE)
return true;
+ if (!mmget_not_zero(mni->mm))
+ return true;
start = mni->interval_tree.start;
last = mni->interval_tree.last;
@@ -2207,6 +2209,7 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,
}
svm_range_unlock(prange);
+ mmput(mni->mm);
return true;
}