aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2020-06-10 08:20:05 -0700
committerKees Cook <[email protected]>2020-07-13 11:03:44 -0700
commit6659061045cc93f609e100b128f30581e5f012e9 (patch)
tree2624a04d064594b211d8a800521eaa93558c1138 /include/linux
parentc0029de50982c1fb215330a5f9d433cec0cfd8cc (diff)
fs: Move __scm_install_fd() to __receive_fd()
In preparation for users of the "install a received file" logic outside of net/ (pidfd and seccomp), relocate and rename __scm_install_fd() from net/core/scm.c to __receive_fd() in fs/file.c, and provide a wrapper named receive_fd_user(), as future patches will change the interface to __receive_fd(). Additionally add a comment to fd_install() as a counterpoint to how __receive_fd() interacts with fput(). Cc: Alexander Viro <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Dmitry Kadashev <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Sargun Dhillon <[email protected]> Cc: Ido Schimmel <[email protected]> Cc: Ioana Ciornei <[email protected]> Cc: [email protected] Cc: [email protected] Reviewed-by: Sargun Dhillon <[email protected]> Acked-by: Christian Brauner <[email protected]> Signed-off-by: Kees Cook <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/file.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/file.h b/include/linux/file.h
index 122f80084a3e..b14ff2ffd0bd 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -91,6 +91,14 @@ extern void put_unused_fd(unsigned int fd);
extern void fd_install(unsigned int fd, struct file *file);
+extern int __receive_fd(struct file *file, int __user *ufd,
+ unsigned int o_flags);
+static inline int receive_fd_user(struct file *file, int __user *ufd,
+ unsigned int o_flags)
+{
+ return __receive_fd(file, ufd, o_flags);
+}
+
extern void flush_delayed_fput(void);
extern void __fput_sync(struct file *);