[PATCH v4 06/72] cgroup: add cgroup namespace to tree after owner is set

Christian Brauner posted 72 patches 3 months, 1 week ago
[PATCH v4 06/72] cgroup: add cgroup namespace to tree after owner is set
Posted by Christian Brauner 3 months, 1 week ago
Otherwise we trip VFS_WARN_ON_ONC() in __ns_tree_add_raw().

Fixes: 7c6059398533 ("cgroup: support ns lookup")
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 kernel/cgroup/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/namespace.c b/kernel/cgroup/namespace.c
index fdbe57578e68..db9617556dd7 100644
--- a/kernel/cgroup/namespace.c
+++ b/kernel/cgroup/namespace.c
@@ -30,7 +30,6 @@ static struct cgroup_namespace *alloc_cgroup_ns(void)
 	ret = ns_common_init(new_ns);
 	if (ret)
 		return ERR_PTR(ret);
-	ns_tree_add(new_ns);
 	return no_free_ptr(new_ns);
 }
 
@@ -86,6 +85,7 @@ struct cgroup_namespace *copy_cgroup_ns(u64 flags,
 	new_ns->ucounts = ucounts;
 	new_ns->root_cset = cset;
 
+	ns_tree_add(new_ns);
 	return new_ns;
 }
 

-- 
2.47.3