Skip to content

Commit fa582c6

Browse files
PhilipYangAalexdeucher
authored andcommitted
drm/amdkfd: Use mmget_not_zero in MMU notifier
MMU notifier callback may pass in mm with mm->mm_users==0 when process is exiting, use mmget_no_zero to avoid accessing invalid mm in deferred list work after mm is gone. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 2a46096 commit fa582c6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_svm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,8 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,
23072307

23082308
if (range->event == MMU_NOTIFY_RELEASE)
23092309
return true;
2310+
if (!mmget_not_zero(mni->mm))
2311+
return true;
23102312

23112313
start = mni->interval_tree.start;
23122314
last = mni->interval_tree.last;
@@ -2333,6 +2335,7 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,
23332335
}
23342336

23352337
svm_range_unlock(prange);
2338+
mmput(mni->mm);
23362339

23372340
return true;
23382341
}

0 commit comments

Comments
 (0)