]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers"
authorOleg Nesterov <oleg@redhat.com>
Wed, 15 Oct 2025 12:36:13 +0000 (14:36 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 10 Feb 2026 10:39:30 +0000 (11:39 +0100)
This reverts commit abdfd4948e45c51b19162cf8b3f5003f8f53c9b9.

The changelog in this commit explains why it is not easy to avoid ns == NULL
when the caller is exiting, but pid_vnr() is equally unsafe in this case.

However, commit 006568ab4c5c ("pid: Add a judgment for ns null in pid_nr_ns")
already added the ns != NULL check in pid_nr_ns(), so we can remove the same
check from __task_pid_nr_ns().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: https://patch.msgid.link/20251015123613.GA9456@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
kernel/pid.c

index 72c9372b84b8f8f9572f44d272cf1162ed250ac8..3b96571d0fe652bbcc22fc80895c4e21df89f16c 100644 (file)
@@ -558,8 +558,7 @@ pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
        rcu_read_lock();
        if (!ns)
                ns = task_active_pid_ns(current);
-       if (ns)
-               nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
+       nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
        rcu_read_unlock();
 
        return nr;