mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
cgroup: add cgroup namespace to tree after owner is set
Otherwise we trip VFS_WARN_ON_ONC() in __ns_tree_add_raw().
Link: https://patch.msgid.link/20251029-work-namespace-nstree-listns-v4-6-2e6f823ebdc0@kernel.org
Fixes: 7c60593985 ("cgroup: support ns lookup")
Tested-by: syzbot@syzkaller.appspotmail.com
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user