... 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>
* 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;
{
struct file *file;
- file = get_empty_filp();
+ file = alloc_empty_file(current_cred());
if (IS_ERR(file))
return file;
/*
* file_table.c
*/
-extern struct file *get_empty_filp(void);
+extern struct file *alloc_empty_file(const struct cred *);
/*
* super.c
int opened = 0;
int error;
- file = get_empty_filp();
+ file = alloc_empty_file(current_cred());
if (IS_ERR(file))
return file;
/* We must always pass in a valid mount pointer. */
BUG_ON(!path->mnt);
- f = get_empty_filp();
+ f = alloc_empty_file(cred);
if (!IS_ERR(f)) {
f->f_flags = flags;
error = vfs_open(path, f, cred);