Skip to content

Commit 1cf2e88

Browse files
oleg-nesterovbrauner
authored andcommitted
Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers"
This reverts commit abdfd49. 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 006568a ("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>
1 parent 87caaee commit 1cf2e88

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

kernel/pid.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,7 @@ pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
558558
rcu_read_lock();
559559
if (!ns)
560560
ns = task_active_pid_ns(current);
561-
if (ns)
562-
nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
561+
nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
563562
rcu_read_unlock();
564563

565564
return nr;

0 commit comments

Comments
 (0)