From: Lu Jialin lujialin4@huawei.com
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: Lu Jialin lujialin4@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com Signed-off-by: chenridong chenridong@huawei.com --- kernel/cgroup/cgroup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 41b16ce99f54..001375f82d88 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2806,6 +2806,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 @@ -2816,12 +2817,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); }
/**