]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pid: rely on common reference count behavior
authorChristian Brauner <brauner@kernel.org>
Mon, 10 Nov 2025 15:08:27 +0000 (16:08 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 11 Nov 2025 09:01:32 +0000 (10:01 +0100)
Now that we changed the generic reference counting mechanism for all
namespaces to never manipulate reference counts of initial namespaces we
can drop the special handling for pid namespaces.

Link: https://patch.msgid.link/20251110-work-namespace-nstree-fixes-v1-15-e8a9264e0fb9@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/pid_namespace.h
kernel/pid_namespace.c

index 445517a72ad0602e528e4b13364ddf8fc40a0b0c..0e7ae12c96d2aea1c8cd14ed3578f92e20317155 100644 (file)
@@ -61,8 +61,7 @@ static inline struct pid_namespace *to_pid_ns(struct ns_common *ns)
 
 static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
 {
-       if (ns != &init_pid_ns)
-               ns_ref_inc(ns);
+       ns_ref_inc(ns);
        return ns;
 }
 
index 650be58d8d1864e14693ab6a3d6f31db03e63251..e48f5de4136138dc61512d3a4c5dcf58f3a43273 100644 (file)
@@ -184,7 +184,7 @@ struct pid_namespace *copy_pid_ns(u64 flags,
 
 void put_pid_ns(struct pid_namespace *ns)
 {
-       if (ns && ns != &init_pid_ns && ns_ref_put(ns))
+       if (ns && ns_ref_put(ns))
                schedule_work(&ns->work);
 }
 EXPORT_SYMBOL_GPL(put_pid_ns);