[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251015123613.GA9456@redhat.com>
Date: Wed, 15 Oct 2025 14:36:13 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Christian Brauner <brauner@...nel.org>
Cc: gaoxiang17 <gaoxiang17@...omi.com>, Mateusz Guzik <mjguzik@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for
zombie callers"
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@...hat.com>
---
kernel/pid.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/pid.c b/kernel/pid.c
index 4fffec767a63..be69ae771e3c 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -515,8 +515,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;
--
2.25.1.362.g51ebf55
Powered by blists - more mailing lists