diff options
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -887,6 +887,10 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags) | |||
887 | return filp; | 887 | return filp; |
888 | } | 888 | } |
889 | 889 | ||
890 | /* | ||
891 | * dentry_open() will have done dput(dentry) and mntput(mnt) if it returns an | ||
892 | * error. | ||
893 | */ | ||
890 | struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) | 894 | struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) |
891 | { | 895 | { |
892 | int error; | 896 | int error; |
@@ -894,8 +898,11 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) | |||
894 | 898 | ||
895 | error = -ENFILE; | 899 | error = -ENFILE; |
896 | f = get_empty_filp(); | 900 | f = get_empty_filp(); |
897 | if (f == NULL) | 901 | if (f == NULL) { |
902 | dput(dentry); | ||
903 | mntput(mnt); | ||
898 | return ERR_PTR(error); | 904 | return ERR_PTR(error); |
905 | } | ||
899 | 906 | ||
900 | return __dentry_open(dentry, mnt, flags, f, NULL); | 907 | return __dentry_open(dentry, mnt, flags, f, NULL); |
901 | } | 908 | } |