path: root/fs/file_table.c
diff options
authorAl Viro <viro@zeniv.linux.org.uk>2018-07-10 13:12:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 10:04:13 -0400
commit6de37b6dc085e7c5e092b69289af66876526da44 (patch)
tree5d2519411b954eb4d97c70fb972d7b8a1fb1c635 /fs/file_table.c
parentalloc_file(): switch to passing O_... flags instead of FMODE_... mode (diff)
pass creds to get_empty_filp(), make sure dentry_open() passes the right creds
... and rename get_empty_filp() to alloc_empty_file(). dentry_open() gets creds as argument, but the only thing that sees those is security_file_open() - file->f_cred still ends up with current_cred(). For almost all callers it's the same thing, but there are several broken cases. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/file_table.c')
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 086c3f5ec31a..76cfa4c43e13 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -101,9 +101,8 @@ int proc_nr_files(struct ctl_table *table, int write,
* done, you will imbalance int the mount's writer count
* and a warning at __fput() time.
-struct file *get_empty_filp(void)
+struct file *alloc_empty_file(const struct cred *cred)
- const struct cred *cred = current_cred();
static long old_max;
struct file *f;
int error;
@@ -161,7 +160,7 @@ struct file *alloc_file(const struct path *path, int flags,
struct file *file;
- file = get_empty_filp();
+ file = alloc_empty_file(current_cred());
if (IS_ERR(file))
return file;