summaryrefslogtreecommitdiff
path: root/fs/file.c
diff options
context:
space:
mode:
authorXie Yongji <xieyongji@bytedance.com>2021-08-31 13:36:24 +0300
committerMichael S. Tsirkin <mst@redhat.com>2021-09-06 14:20:56 +0300
commit9c930054f2f5326d59ee4bf8d7d1cf6c82f5643b (patch)
tree6306ff784fd8448edf9379b516d89ca96bdad559 /fs/file.c
parent7a6b92d33ab166c6ea6e5764033ca99dcb6ec361 (diff)
downloadlinux-9c930054f2f5326d59ee4bf8d7d1cf6c82f5643b.tar.xz
file: Export receive_fd() to modules
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji <xieyongji@bytedance.com> Acked-by: Jason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210831103634.33-4-xieyongji@bytedance.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'fs/file.c')
-rw-r--r--fs/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/file.c b/fs/file.c
index 86dc9956af32..210e540672aa 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -1134,6 +1134,12 @@ int receive_fd_replace(int new_fd, struct file *file, unsigned int o_flags)
return new_fd;
}
+int receive_fd(struct file *file, unsigned int o_flags)
+{
+ return __receive_fd(file, NULL, o_flags);
+}
+EXPORT_SYMBOL_GPL(receive_fd);
+
static int ksys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
{
int err = -EBADF;