mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
propagate error from get_empty_filp() to its callers
Based on parts from Anatol's patch (the rest is the next commit). Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
496ad9aa8e
commit
1afc99beaf
3 changed files with 28 additions and 30 deletions
27
fs/open.c
27
fs/open.c
|
|
@ -810,23 +810,22 @@ struct file *dentry_open(const struct path *path, int flags,
|
|||
/* We must always pass in a valid mount pointer. */
|
||||
BUG_ON(!path->mnt);
|
||||
|
||||
error = -ENFILE;
|
||||
f = get_empty_filp();
|
||||
if (f == NULL)
|
||||
return ERR_PTR(error);
|
||||
|
||||
f->f_flags = flags;
|
||||
f->f_path = *path;
|
||||
error = do_dentry_open(f, NULL, cred);
|
||||
if (!error) {
|
||||
error = open_check_o_direct(f);
|
||||
if (error) {
|
||||
fput(f);
|
||||
if (!IS_ERR(f)) {
|
||||
f->f_flags = flags;
|
||||
f->f_path = *path;
|
||||
error = do_dentry_open(f, NULL, cred);
|
||||
if (!error) {
|
||||
/* from now on we need fput() to dispose of f */
|
||||
error = open_check_o_direct(f);
|
||||
if (error) {
|
||||
fput(f);
|
||||
f = ERR_PTR(error);
|
||||
}
|
||||
} else {
|
||||
put_filp(f);
|
||||
f = ERR_PTR(error);
|
||||
}
|
||||
} else {
|
||||
put_filp(f);
|
||||
f = ERR_PTR(error);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue