提交 fcbf90cf 编写于 作者: W Wang Wensheng 提交者: Yang Yingliang

share_pool: Fix a potential bug branch

ascend inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI
CVE: NA

-------------------

When we add a task to a new group, we create and initialize the group at
first. The is_active element of spg should not be true until the fully
process completed, or the BUG of freeing an active spg shall occur if the
works after the initialization raise an error.
Signed-off-by: NWang Wensheng <wangwensheng4@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NTang Yizhou <tangyizhou@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 d47ef9cf
...@@ -374,7 +374,7 @@ static struct sp_group *find_or_alloc_sp_group(int spg_id) ...@@ -374,7 +374,7 @@ static struct sp_group *find_or_alloc_sp_group(int spg_id)
atomic64_set(&spg->alloc_nsize, 0); atomic64_set(&spg->alloc_nsize, 0);
atomic64_set(&spg->alloc_hsize, 0); atomic64_set(&spg->alloc_hsize, 0);
atomic64_set(&spg->alloc_size, 0); atomic64_set(&spg->alloc_size, 0);
spg->is_alive = true; spg->is_alive = false;
spg->hugepage_failures = 0; spg->hugepage_failures = 0;
spg->dvpp_multi_spaces = false; spg->dvpp_multi_spaces = false;
spg->owner = current->group_leader; spg->owner = current->group_leader;
...@@ -591,6 +591,8 @@ int sp_group_add_task(int pid, int spg_id) ...@@ -591,6 +591,8 @@ int sp_group_add_task(int pid, int spg_id)
} }
mm->sp_group = spg; mm->sp_group = spg;
/* We reactive the spg even the spg exists already. */
spg->is_alive = true;
list_add_tail(&tsk->mm->sp_node, &spg->procs); list_add_tail(&tsk->mm->sp_node, &spg->procs);
/* /*
* create mappings of existing shared memory segments into this * create mappings of existing shared memory segments into this
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册