From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>
Cc: gaoxiang17 <gaoxiang17@xiaomi.com>,
Mateusz Guzik <mjguzik@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers"
Date: Wed, 15 Oct 2025 14:36:13 +0200 [thread overview]
Message-ID: <20251015123613.GA9456@redhat.com> (raw)
In-Reply-To: <20251015123550.GA9447@redhat.com>
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>
---
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
next prev parent reply other threads:[~2025-10-15 12:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 12:35 [PATCH 0/2] Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers" Oleg Nesterov
2025-10-15 12:36 ` Oleg Nesterov [this message]
2025-10-15 12:36 ` [PATCH 2/2] pid: introduce task_ppid_vnr() helper Oleg Nesterov
2026-01-29 14:59 ` [PATCH 0/2] Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers" Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251015123613.GA9456@redhat.com \
--to=oleg@redhat.com \
--cc=brauner@kernel.org \
--cc=gaoxiang17@xiaomi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.