fs: namespace: drop BUG_ON() in copy_mnt_ns()

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>
Link: https://patch.msgid.link/20260903064828.126643-4-sunshaojie@kylinos.cn
Reviewed-by: Tao Cui <cuitao@kylinos.cn>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
Shaojie Sun 2026-09-03 14:48:28 +08:00 committed by Christian Brauner
parent d54cc3a527
commit 4141e148e6
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

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