Commit f72709d7 authored by Zhang Jian's avatar Zhang Jian Committed by Yang Yingliang
Browse files

share_pool: add mm address check when access the process's sp_group file

ascend inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4JICC


CVE: NA

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

When we access the process's sp_group file and the precess is a kernel
process, it's task_struct->mm value will be 0, so we must check it, and
make sure the process is not a kernel process.

v1->v2: The path of a process as a kernel process is not often triggered,
so add a unlikely function to accelerate execytion.

Signed-off-by: default avatarZhang Jian <zhangjian210@huawei.com>
Reviewed-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent fbf4e285
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3851,13 +3851,17 @@ int proc_sp_group_state(struct seq_file *m, struct pid_namespace *ns,
			struct pid *pid, struct task_struct *task)
{
	struct mm_struct *mm = task->mm;
	struct sp_group_master *master = mm->sp_group_master;
	struct sp_group_master *master;
	struct sp_proc_stat *proc_stat;
	struct spg_proc_stat *spg_proc_stat;
	int i;
	unsigned long anon, file, shmem, total_rss, prot;
	long sp_res, sp_res_nsize, non_sp_res, non_sp_shm;

	if (unlikely(!mm))
		return 0;

	master = mm->sp_group_master;
	if (!master)
		return 0;