[PATCH v2 0/3] drop BUG_ON() NULL checks in namespace copy helpers

From: Shaojie Sun

Date: Thu Sep 03 2026 - 02:51:31 EST


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.

The copy_*_ns() helpers are inconsistent in how they handle a NULL
namespace pointer. copy_mnt_ns(), copy_utsname() and copy_cgroup_ns()
have a BUG_ON() on the pointer, while copy_time_ns(), copy_pid_ns(),
copy_ipcs() and copy_net_ns() don't check it at all.

The sole caller, create_new_namespaces(), always passes the
corresponding namespace pointer from the task's nsproxy, so the checks
can never trigger and the helpers dereference the pointer right away
anyway.

Drop the BUG_ON()s so that all copy_*_ns() helpers behave consistently.
The maintainers of the respective subsystems are on Cc.

Shaojie Sun (3):
cgroup: namespace: drop BUG_ON() in copy_cgroup_ns()
uts: drop BUG_ON() in copy_utsname()
fs: namespace: drop BUG_ON() in copy_mnt_ns()

fs/namespace.c | 2 --
kernel/cgroup/namespace.c | 2 --
kernel/utsname.c | 1 -
3 files changed, 5 deletions(-)

--
2.50.1