[PATCH v2 3/3] fs: namespace: drop BUG_ON() in copy_mnt_ns()

From: Shaojie Sun

Date: Thu Sep 03 2026 - 02:53:41 EST


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@xxxxxxxxxx>
---
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