diff options
| author | Christian Brauner <[email protected]> | 2024-10-08 11:30:49 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2024-10-22 09:16:58 +0000 |
| commit | 2714b0d1f36999dbd99a3474a24e7301acbd74f1 (patch) | |
| tree | b7d5fb2890cde3ece91a99a53d779bdd7f242370 /rust/helpers/security.c | |
| parent | vfs: inode insertion kdoc corrections (diff) | |
| download | kernel-2714b0d1f36999dbd99a3474a24e7301acbd74f1.tar.gz kernel-2714b0d1f36999dbd99a3474a24e7301acbd74f1.zip | |
fcntl: make F_DUPFD_QUERY associative
Currently when passing a closed file descriptor to
fcntl(fd, F_DUPFD_QUERY, fd_dup) the order matters:
fd = open("/dev/null");
fd_dup = dup(fd);
When we now close one of the file descriptors we get:
(1) fcntl(fd, fd_dup) // -EBADF
(2) fcntl(fd_dup, fd) // 0 aka not equal
depending on which file descriptor is passed first. That's not a huge
deal but it gives the api I slightly weird feel. Make it so that the
order doesn't matter by requiring that both file descriptors are valid:
(1') fcntl(fd, fd_dup) // -EBADF
(2') fcntl(fd_dup, fd) // -EBADF
Link: https://lore.kernel.org/r/20241008-duften-formel-251f967602d5@brauner
Fixes: c62b758bae6a ("fcntl: add F_DUPFD_QUERY fcntl()")
Reviewed-by: Jeff Layton <[email protected]>
Reviewed-By: Lennart Poettering <[email protected]>
Cc: [email protected]
Reported-by: Lennart Poettering <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'rust/helpers/security.c')
0 files changed, 0 insertions, 0 deletions
