aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-02-14 20:41:04 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-22 23:31:32 -0500
commit1afc99beaf0fca3767d9b67789a7ae91c4f7a9c9 (patch)
tree9aba84bc2d8e4873859bd81ddf1002fe0e3f9376 /fs/open.c
parent496ad9aa8ef448058e36ca7a787c61f2e63f0f54 (diff)
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 <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/open.c b/fs/open.c
index e08643feb574..97a237f67b72 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -810,23 +810,22 @@ struct file *dentry_open(const struct path *path, int flags,
810 /* We must always pass in a valid mount pointer. */ 810 /* We must always pass in a valid mount pointer. */
811 BUG_ON(!path->mnt); 811 BUG_ON(!path->mnt);
812 812
813 error = -ENFILE;
814 f = get_empty_filp(); 813 f = get_empty_filp();
815 if (f == NULL) 814 if (!IS_ERR(f)) {
816 return ERR_PTR(error); 815 f->f_flags = flags;
817 816 f->f_path = *path;
818 f->f_flags = flags; 817 error = do_dentry_open(f, NULL, cred);
819 f->f_path = *path; 818 if (!error) {
820 error = do_dentry_open(f, NULL, cred); 819 /* from now on we need fput() to dispose of f */
821 if (!error) { 820 error = open_check_o_direct(f);
822 error = open_check_o_direct(f); 821 if (error) {
823 if (error) { 822 fput(f);
824 fput(f); 823 f = ERR_PTR(error);
824 }
825 } else {
826 put_filp(f);
825 f = ERR_PTR(error); 827 f = ERR_PTR(error);
826 } 828 }
827 } else {
828 put_filp(f);
829 f = ERR_PTR(error);
830 } 829 }
831 return f; 830 return f;
832} 831}