summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-09-04 12:46:48 +0200
committerChristian Brauner <brauner@kernel.org>2026-09-04 12:46:48 +0200
commit03c9d11bfda9cdb81d4979f30ddb0f3c4d5a2aae (patch)
treedd510c46a5dbe3e97a7418b4f1f16cbd62e2c3cd
parentfec2c3c0744bf3ce2aaafb1fd3fd5289cfd4814c (diff)
parent4141e148e629eb9ca161354635ae40de55d8f552 (diff)
downloadlinux-next-03c9d11bfda9cdb81d4979f30ddb0f3c4d5a2aae.tar.gz
linux-next-03c9d11bfda9cdb81d4979f30ddb0f3c4d5a2aae.zip
Merge patch series "drop BUG_ON() NULL checks in namespace copy helpers"
Shaojie Sun <sunshaojie@kylinos.cn> says: 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. * patches from https://patch.msgid.link/20260903064828.126643-1-sunshaojie@kylinos.cn: fs: namespace: drop BUG_ON() in copy_mnt_ns() uts: drop BUG_ON() in copy_utsname() Link: https://patch.msgid.link/20260903064828.126643-1-sunshaojie@kylinos.cn Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
-rw-r--r--fs/namespace.c2
-rw-r--r--kernel/utsname.c1
2 files changed, 0 insertions, 3 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;
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))