]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pid: port to ns_ref_*() helpers
authorChristian Brauner <brauner@kernel.org>
Thu, 18 Sep 2025 10:11:50 +0000 (12:11 +0200)
committerChristian Brauner <brauner@kernel.org>
Fri, 19 Sep 2025 14:22:37 +0000 (16:22 +0200)
Stop accessing ns.count directly.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/pid_namespace.h
kernel/pid_namespace.c

index ba0efc8c8596b336fb0b13a54bfb73c6988e8995..5b2f29d369c47603ef1c2e0a98bd8a3da7b92381 100644 (file)
@@ -62,7 +62,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)
-               refcount_inc(&ns->ns.count);
+               ns_ref_inc(ns);
        return ns;
 }
 
index 27e2dd9ee0515cf73e6e8ba18191fbbf03ca351e..162f5fb63d75a8b2922cb6b626d6415534cc1dc0 100644 (file)
@@ -169,7 +169,7 @@ static void destroy_pid_namespace_work(struct work_struct *work)
                parent = ns->parent;
                destroy_pid_namespace(ns);
                ns = parent;
-       } while (ns != &init_pid_ns && refcount_dec_and_test(&ns->ns.count));
+       } while (ns != &init_pid_ns && ns_ref_put(ns));
 }
 
 struct pid_namespace *copy_pid_ns(unsigned long flags,
@@ -184,7 +184,7 @@ struct pid_namespace *copy_pid_ns(unsigned long flags,
 
 void put_pid_ns(struct pid_namespace *ns)
 {
-       if (ns && ns != &init_pid_ns && refcount_dec_and_test(&ns->ns.count))
+       if (ns && ns != &init_pid_ns && ns_ref_put(ns))
                schedule_work(&ns->work);
 }
 EXPORT_SYMBOL_GPL(put_pid_ns);