lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1649413394-17501-1-git-send-email-zhaoyang.huang@unisoc.com>
Date:   Fri, 8 Apr 2022 18:23:14 +0800
From:   "zhaoyang.huang" <zhaoyang.huang@...soc.com>
To:     Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Zhaoyang Huang <huangzhaoyang@...il.com>,
        <linux-kernel@...r.kernel.org>, <cgroups@...r.kernel.org>,
        <ke.wang@...soc.com>
Subject: [PATCH] cgroup: fix attach task fail when subtree_control configured

From: Zhaoyang Huang <zhaoyang.huang@...soc.com>

It is found that task attach to a vacant cgroup will fail when its
subtree_control has been configured. Fix it by judging if there is no chrildren
existed.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@...soc.com>
---
 kernel/cgroup/cgroup.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 919194d..f00583b 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2561,6 +2561,9 @@ static int cgroup_migrate_execute(struct cgroup_mgctx *mgctx)
  */
 int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp)
 {
+	struct cgroup_subsys_state *css = &dst_cgrp->self;
+	struct list_head *children = &css->children;
+
 	/* v1 doesn't have any restriction */
 	if (!cgroup_on_dfl(dst_cgrp))
 		return 0;
@@ -2581,7 +2584,7 @@ int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp)
 		return 0;
 
 	/* apply no-internal-process constraint */
-	if (dst_cgrp->subtree_control)
+	if (dst_cgrp->subtree_control && !list_empty(children))
 		return -EBUSY;
 
 	return 0;
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ