diff options
author | 2025-03-10 08:53:40 +0100 | |
---|---|---|
committer | 2025-03-10 08:53:40 +0100 | |
commit | 38962d9b15ce3d50f5c61dc441b7c53f4e0d2e33 (patch) | |
tree | 81128bf50faaf28fc8bc65ebaa8e207c1b40cebc /fs/pidfs.c | |
parent | Merge patch series "some pipe + wait stuff" (diff) | |
parent | fs/pipe: add simpler helpers for common cases (diff) | |
download | wireguard-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.c | 13 |
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, }; |