Re: [PATCH v2 2/3] uts: drop BUG_ON() in copy_utsname()

From: Bradley Morgan

Date: Thu Sep 03 2026 - 06:48:16 EST


On 3 September 2026 07:48:27 BST, Shaojie Sun <sunshaojie@xxxxxxxxxx>
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@xxxxxxxxxxxxxx>


>Signed-off-by: Shaojie Sun <sunshaojie@xxxxxxxxxx>
>---
> 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@xxxxxxxxx/