From: Tang Yizhou tangyizhou@huawei.com
ascend inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI CVE: NA
-------------------------------------------------
do_munmap() is called in sp_munmap_task_areas(), we should leverage mm->mmap_sem.
Signed-off-by: Tang Yizhou tangyizhou@huawei.com Reviewed-by: Ding Tianhong dingtianhong@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- mm/share_pool.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/mm/share_pool.c b/mm/share_pool.c index 36e33d1de4f8c..9bf872ed680eb 100644 --- a/mm/share_pool.c +++ b/mm/share_pool.c @@ -661,7 +661,9 @@ int sp_group_add_task(int pid, int spg_id) "failed (potential no enough memory): %d " "spa type is %d\n", ret, spa->type); } + down_write(&mm->mmap_sem); sp_munmap_task_areas(mm, spa->link.next); + up_write(&mm->mmap_sem); spin_lock(&sp_area_lock); break; }