From: Guo Mengqi guomengqi3@huawei.com
Offering: HULK hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I5MS48 CVE: NA
--------------------------------
Fix two bugs revealed by static check:
- Release the mm->mmap_lock when mm->sp_group_master had not been initialized. - Do not add mm to master list if there process add group failed.
Signed-off-by: Guo Mengqi guomengqi3@huawei.com --- mm/share_pool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/share_pool.c b/mm/share_pool.c index 8cc75d996e0f..4fb594491cce 100644 --- a/mm/share_pool.c +++ b/mm/share_pool.c @@ -500,6 +500,7 @@ static int sp_init_group_master_locked(struct task_struct *tsk, struct mm_struct return 0;
free_master: + list_del(&master->list_node); mm->sp_group_master = NULL; kfree(master);
@@ -3810,8 +3811,10 @@ int proc_sp_group_state(struct seq_file *m, struct pid_namespace *ns,
down_read(&mm->mmap_lock); master = mm->sp_group_master; - if (!master) + if (!master) { + up_read(&mm->mmap_lock); return 0; + }
get_mm_rss_info(mm, &anon, &file, &shmem, &total_rss); proc_stat = &master->instat;