Re: [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns()
From: Tao Cui
Date: Thu Sep 03 2026 - 05:37:07 EST
在 2026/9/3 14:48, Shaojie Sun 写道:
> The sole caller, create_new_namespaces(), always passes a valid cgroup
> namespace pointer from the task's nsproxy. The other copy_*_ns()
> helpers, e.g. copy_time_ns() and copy_pid_ns(), don't perform such a
> check either. Drop the BUG_ON() for consistency with them.
>
> Signed-off-by: Shaojie Sun <sunshaojie@xxxxxxxxxx>
> ---
> kernel/cgroup/namespace.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/cgroup/namespace.c b/kernel/cgroup/namespace.c
> index ea4ee13936be..76660332ec64 100644
> --- a/kernel/cgroup/namespace.c
> +++ b/kernel/cgroup/namespace.c
> @@ -53,8 +53,6 @@ struct cgroup_namespace *copy_cgroup_ns(u64 flags,
> struct ucounts *ucounts;
> struct css_set *cset;
>
> - BUG_ON(!old_ns);
> -
> if (!(flags & CLONE_NEWCGROUP)) {
> get_cgroup_ns(old_ns);
> return old_ns;
Reviewed-by: Tao Cui <cuitao@xxxxxxxxxx>