]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
pidfs: protect PIDFD_GET_* ioctls() via ifdef
authorChristian Brauner <brauner@kernel.org>
Wed, 24 Dec 2025 12:00:24 +0000 (13:00 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 6 Jan 2026 22:08:12 +0000 (23:08 +0100)
commit75ddaa4ddc86d31edb15e50152adf4ddee77a6ba
tree33b0f6e26e24051de90102290222f7bad6e2b988
parent78c850021d36d43401de2fb4758f02df93266a6f
pidfs: protect PIDFD_GET_* ioctls() via ifdef

We originally protected PIDFD_GET_<ns-type>_NAMESPACE ioctls() through
ifdefs and recent rework made it possible to drop them. There was an
oversight though. When the relevant namespace is turned off ns->ops will
be NULL so even though opening a file descriptor is perfectly legitimate
it would fail during inode eviction when the file was closed.

The simple fix would be to check ns->ops for NULL and continue allow to
retrieve namespace fds from pidfds but we don't allow retrieving them
when the relevant namespace type is turned off. So keep the
simplification but add the ifdefs back in.

Link: https://lore.kernel.org/20251222214907.GA189632@quark
Link: https://patch.msgid.link/20251224-ununterbrochen-gagen-ea949b83f8f2@brauner
Fixes: a71e4f103aed ("pidfs: simplify PIDFD_GET_<type>_NAMESPACE ioctls")
Tested-by: Brendan Jackman <jackmanb@kernel.org>
Tested-by: Eric Biggers <ebiggers@kernel.org>
Reported-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/pidfs.c