mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-26 21:52:20 +00:00
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>
This commit is contained in:
parent
2a46096335
commit
fa582c6f36
@ -2307,6 +2307,8 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,
|
|||||||
|
|
||||||
if (range->event == MMU_NOTIFY_RELEASE)
|
if (range->event == MMU_NOTIFY_RELEASE)
|
||||||
return true;
|
return true;
|
||||||
|
if (!mmget_not_zero(mni->mm))
|
||||||
|
return true;
|
||||||
|
|
||||||
start = mni->interval_tree.start;
|
start = mni->interval_tree.start;
|
||||||
last = mni->interval_tree.last;
|
last = mni->interval_tree.last;
|
||||||
@ -2333,6 +2335,7 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,
|
|||||||
}
|
}
|
||||||
|
|
||||||
svm_range_unlock(prange);
|
svm_range_unlock(prange);
|
||||||
|
mmput(mni->mm);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user