* [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns()
2026-09-03 6:48 ` [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers Shaojie Sun
@ 2026-09-03 6:48 ` Shaojie Sun
2026-09-03 9:28 ` Tao Cui
2026-09-03 16:47 ` Tejun Heo
2026-09-03 6:48 ` [PATCH v2 2/3] uts: drop BUG_ON() in copy_utsname() Shaojie Sun
` (3 subsequent siblings)
4 siblings, 2 replies; 13+ messages in thread
From: Shaojie Sun @ 2026-09-03 6:48 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, Michal Koutný, Christian Brauner,
Alexander Viro
Cc: Jan Kara, Pavel Tikhomirov, cgroups, linux-fsdevel, linux-kernel,
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@kylinos.cn>
---
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;
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns()
2026-09-03 6:48 ` [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns() Shaojie Sun
@ 2026-09-03 9:28 ` Tao Cui
2026-09-03 16:47 ` Tejun Heo
1 sibling, 0 replies; 13+ messages in thread
From: Tao Cui @ 2026-09-03 9:28 UTC (permalink / raw)
To: Shaojie Sun, Tejun Heo, Johannes Weiner, Michal Koutný,
Christian Brauner, Alexander Viro
Cc: cui.tao, Jan Kara, Pavel Tikhomirov, cgroups, linux-fsdevel,
linux-kernel
在 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@kylinos.cn>
> ---
> 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@kylinos.cn>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns()
2026-09-03 6:48 ` [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns() Shaojie Sun
2026-09-03 9:28 ` Tao Cui
@ 2026-09-03 16:47 ` Tejun Heo
1 sibling, 0 replies; 13+ messages in thread
From: Tejun Heo @ 2026-09-03 16:47 UTC (permalink / raw)
To: Shaojie Sun
Cc: Johannes Weiner, Michal Koutný, Christian Brauner,
Alexander Viro, Jan Kara, Pavel Tikhomirov, Tao Cui, cgroups,
linux-fsdevel, linux-kernel
Hello,
On Thu, Sep 03, 2026 at 02:48:26PM +0800, Shaojie Sun wrote:
> 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@kylinos.cn>
Applied to cgroup/for-7.4 with Tao's Reviewed-by added.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 2/3] uts: drop BUG_ON() in copy_utsname()
2026-09-03 6:48 ` [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers Shaojie Sun
2026-09-03 6:48 ` [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns() Shaojie Sun
@ 2026-09-03 6:48 ` Shaojie Sun
2026-09-03 8:40 ` Bradley Morgan
2026-09-03 6:48 ` [PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns() Shaojie Sun
` (2 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Shaojie Sun @ 2026-09-03 6:48 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, Michal Koutný, Christian Brauner,
Alexander Viro
Cc: Jan Kara, Pavel Tikhomirov, cgroups, linux-fsdevel, linux-kernel,
Shaojie Sun
The sole caller, create_new_namespaces(), always passes a valid uts
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@kylinos.cn>
---
kernel/utsname.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/utsname.c b/kernel/utsname.c
index ebbfc578a9d3..1ebf87e24607 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -81,7 +81,6 @@ struct uts_namespace *copy_utsname(u64 flags,
{
struct uts_namespace *new_ns;
- BUG_ON(!old_ns);
get_uts_ns(old_ns);
if (!(flags & CLONE_NEWUTS))
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v2 2/3] uts: drop BUG_ON() in copy_utsname()
2026-09-03 6:48 ` [PATCH v2 2/3] uts: drop BUG_ON() in copy_utsname() Shaojie Sun
@ 2026-09-03 8:40 ` Bradley Morgan
0 siblings, 0 replies; 13+ messages in thread
From: Bradley Morgan @ 2026-09-03 8:40 UTC (permalink / raw)
To: sunshaojie
Cc: brauner, cgroups, hannes, jack, linux-fsdevel, linux-kernel,
mkoutny, ptikhomirov, tj, viro
On 3 September 2026 07:48:27 BST, Shaojie Sun <sunshaojie@kylinos.cn>
wrote:
>The sole caller, create_new_namespaces(), always passes a valid uts
>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.
>
Reviewed-by: Bradley Morgan <brads@mainlining.org>
>Signed-off-by: Shaojie Sun <sunshaojie@kylinos.cn>
>---
> kernel/utsname.c | 1 -
> 1 file changed, 1 deletion(-)
>
>diff --git a/kernel/utsname.c b/kernel/utsname.c
>index ebbfc578a9d3..1ebf87e24607 100644
>--- a/kernel/utsname.c
>+++ b/kernel/utsname.c
>@@ -81,7 +81,6 @@ struct uts_namespace *copy_utsname(u64 flags,
> {
> struct uts_namespace *new_ns;
>
>- BUG_ON(!old_ns);
> get_uts_ns(old_ns);
>
> if (!(flags & CLONE_NEWUTS))
>
--- Thanks!
https://lore.kernel.org/all/EE579805-42F2-4C58-B752-F28779EEB717@grrlz.net/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns()
2026-09-03 6:48 ` [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers Shaojie Sun
2026-09-03 6:48 ` [PATCH v2 1/3] cgroup: namespace: drop BUG_ON() in copy_cgroup_ns() Shaojie Sun
2026-09-03 6:48 ` [PATCH v2 2/3] uts: drop BUG_ON() in copy_utsname() Shaojie Sun
@ 2026-09-03 6:48 ` Shaojie Sun
2026-09-03 9:29 ` Tao Cui
2026-09-03 10:43 ` Jan Kara
2026-09-03 8:02 ` [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers Shaojie Sun
2026-09-04 10:48 ` (subset) " Christian Brauner
4 siblings, 2 replies; 13+ messages in thread
From: Shaojie Sun @ 2026-09-03 6:48 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, Michal Koutný, Christian Brauner,
Alexander Viro
Cc: Jan Kara, Pavel Tikhomirov, cgroups, linux-fsdevel, linux-kernel,
Shaojie Sun
The sole caller, create_new_namespaces(), always passes a valid mount
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@kylinos.cn>
---
fs/namespace.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 1ecd96c918b3..0f35c8c14027 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4247,8 +4247,6 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
struct mount *new;
int copy_flags;
- BUG_ON(!ns);
-
if (likely(!(flags & CLONE_NEWNS))) {
get_mnt_ns(ns);
return ns;
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns()
2026-09-03 6:48 ` [PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns() Shaojie Sun
@ 2026-09-03 9:29 ` Tao Cui
2026-09-03 10:43 ` Jan Kara
1 sibling, 0 replies; 13+ messages in thread
From: Tao Cui @ 2026-09-03 9:29 UTC (permalink / raw)
To: Shaojie Sun, Tejun Heo, Johannes Weiner, Michal Koutný,
Christian Brauner, Alexander Viro
Cc: cui.tao, Jan Kara, Pavel Tikhomirov, cgroups, linux-fsdevel,
linux-kernel
在 2026/9/3 14:48, Shaojie Sun 写道:
> The sole caller, create_new_namespaces(), always passes a valid mount
> 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@kylinos.cn>
> ---
> fs/namespace.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 1ecd96c918b3..0f35c8c14027 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -4247,8 +4247,6 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
> struct mount *new;
> int copy_flags;
>
> - BUG_ON(!ns);
> -
> if (likely(!(flags & CLONE_NEWNS))) {
> get_mnt_ns(ns);
> return ns;
Reviewed-by: Tao Cui <cuitao@kylinos.cn>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns()
2026-09-03 6:48 ` [PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns() Shaojie Sun
2026-09-03 9:29 ` Tao Cui
@ 2026-09-03 10:43 ` Jan Kara
1 sibling, 0 replies; 13+ messages in thread
From: Jan Kara @ 2026-09-03 10:43 UTC (permalink / raw)
To: Shaojie Sun
Cc: Tejun Heo, Johannes Weiner, Michal Koutný, Christian Brauner,
Alexander Viro, Jan Kara, Pavel Tikhomirov, cgroups,
linux-fsdevel, linux-kernel
On Thu 03-09-26 14:48:28, Shaojie Sun wrote:
> The sole caller, create_new_namespaces(), always passes a valid mount
> 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@kylinos.cn>
It's indeed pointless. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/namespace.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 1ecd96c918b3..0f35c8c14027 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -4247,8 +4247,6 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
> struct mount *new;
> int copy_flags;
>
> - BUG_ON(!ns);
> -
> if (likely(!(flags & CLONE_NEWNS))) {
> get_mnt_ns(ns);
> return ns;
> --
> 2.50.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers
2026-09-03 6:48 ` [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers Shaojie Sun
` (2 preceding siblings ...)
2026-09-03 6:48 ` [PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns() Shaojie Sun
@ 2026-09-03 8:02 ` Shaojie Sun
2026-09-04 10:48 ` (subset) " Christian Brauner
4 siblings, 0 replies; 13+ messages in thread
From: Shaojie Sun @ 2026-09-03 8:02 UTC (permalink / raw)
To: Tejun Heo, Michal Koutný; +Cc: cgroups, linux-kernel, Shaojie Sun
Apologies, the cover letter of this series says
"... following the discussion with Tejun."
It should read "... following the discussion with Michal Koutný".
The patches themselves are unaffected.
Thanks,
Shaojie
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: (subset) [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers
2026-09-03 6:48 ` [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers Shaojie Sun
` (3 preceding siblings ...)
2026-09-03 8:02 ` [PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers Shaojie Sun
@ 2026-09-04 10:48 ` Christian Brauner
4 siblings, 0 replies; 13+ messages in thread
From: Christian Brauner @ 2026-09-04 10:48 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, Michal Koutný, Alexander Viro,
Shaojie Sun
Cc: Jan Kara, Pavel Tikhomirov, cgroups, linux-fsdevel, linux-kernel
On Thu, 03 Sep 2026 14:48:25 +0800, Shaojie Sun wrote:
> drop BUG_ON() NULL checks in namespace copy helpers
>
> v2:
> - Reworked into a 3-patch series that simply drops the BUG_ON()s
> instead of replacing them with WARN_ON_ONCE() + error return,
> following the discussion with Tejun. Now also covers copy_utsname()
> and copy_mnt_ns() so that all copy_*_ns() helpers behave
> consistently.
>
> [...]
Applied to the namespace-7.4.misc branch of the vfs/vfs.git tree.
Patches in the namespace-7.4.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: master
[2/3] uts: drop BUG_ON() in copy_utsname()
https://git.kernel.org/vfs/vfs/c/d54cc3a5272c
[3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns()
https://git.kernel.org/vfs/vfs/c/4141e148e629
^ permalink raw reply [flat|nested] 13+ messages in thread