Commit d62e6d48 authored by Lu Jialin's avatar Lu Jialin Committed by yanhaitao
Browse files

cgroup: Return ERSCH when add Z process into task

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8QLND


CVE: NA

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

When echo a Z process into tasks, it should return -ERSCH instead of 0.

Signed-off-by: default avatarLu Jialin <lujialin4@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: default avatarchenridong <chenridong@huawei.com>
parent 53e871a3
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2818,6 +2818,7 @@ int cgroup_migrate(struct task_struct *leader, bool threadgroup,
		   struct cgroup_mgctx *mgctx)
{
	struct task_struct *task;
	int err = 0;

	/*
	 * The following thread iteration should be inside an RCU critical
@@ -2828,12 +2829,15 @@ int cgroup_migrate(struct task_struct *leader, bool threadgroup,
	task = leader;
	do {
		cgroup_migrate_add_task(task, mgctx);
		if (!threadgroup)
		if (!threadgroup) {
			if (task->flags & PF_EXITING)
				err = -ESRCH;
			break;
		}
	} while_each_thread(leader, task);
	spin_unlock_irq(&css_set_lock);

	return cgroup_migrate_execute(mgctx);
	return err ? err : cgroup_migrate_execute(mgctx);
}

/**