aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/pidfs.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-03-10 08:53:40 +0100
committerChristian Brauner <brauner@kernel.org>2025-03-10 08:53:40 +0100
commit38962d9b15ce3d50f5c61dc441b7c53f4e0d2e33 (patch)
tree81128bf50faaf28fc8bc65ebaa8e207c1b40cebc /fs/pidfs.c
parentMerge patch series "some pipe + wait stuff" (diff)
parentfs/pipe: add simpler helpers for common cases (diff)
downloadwireguard-linux-38962d9b15ce3d50f5c61dc441b7c53f4e0d2e33.tar.xz
wireguard-linux-38962d9b15ce3d50f5c61dc441b7c53f4e0d2e33.zip
Merge mainline pipe changes
Mainline now contains various changes to pipes that are relevant for other pipe work this cycle. So merge them into the respective VFS tree. Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/pidfs.c')
-rw-r--r--fs/pidfs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/pidfs.c b/fs/pidfs.c
index 049352f973de..c0478b3c55d9 100644
--- a/fs/pidfs.c
+++ b/fs/pidfs.c
@@ -287,7 +287,6 @@ static bool pidfs_ioctl_valid(unsigned int cmd)
switch (cmd) {
case FS_IOC_GETVERSION:
case PIDFD_GET_CGROUP_NAMESPACE:
- case PIDFD_GET_INFO:
case PIDFD_GET_IPC_NAMESPACE:
case PIDFD_GET_MNT_NAMESPACE:
case PIDFD_GET_NET_NAMESPACE:
@@ -300,6 +299,17 @@ static bool pidfs_ioctl_valid(unsigned int cmd)
return true;
}
+ /* Extensible ioctls require some more careful checks. */
+ switch (_IOC_NR(cmd)) {
+ case _IOC_NR(PIDFD_GET_INFO):
+ /*
+ * Try to prevent performing a pidfd ioctl when someone
+ * erronously mistook the file descriptor for a pidfd.
+ * This is not perfect but will catch most cases.
+ */
+ return (_IOC_TYPE(cmd) == _IOC_TYPE(PIDFD_GET_INFO));
+ }
+
return false;
}
@@ -511,7 +521,6 @@ static char *pidfs_dname(struct dentry *dentry, char *buffer, int buflen)
}
const struct dentry_operations pidfs_dentry_operations = {
- .d_delete = always_delete_dentry,
.d_dname = pidfs_dname,
.d_prune = stashed_dentry_prune,
};