aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c
index b0df7ea733d7..024993535b6f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -625,8 +625,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
625 if (dentry->d_inode->i_op->put_link) 625 if (dentry->d_inode->i_op->put_link)
626 dentry->d_inode->i_op->put_link(dentry, nd, cookie); 626 dentry->d_inode->i_op->put_link(dentry, nd, cookie);
627 } 627 }
628 dput(dentry); 628 path_put(path);
629 mntput(path->mnt);
630 629
631 return error; 630 return error;
632} 631}
@@ -1033,8 +1032,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1033 result = __link_path_walk(name, nd); 1032 result = __link_path_walk(name, nd);
1034 } 1033 }
1035 1034
1036 dput(save.path.dentry); 1035 path_put(&save.path);
1037 mntput(save.path.mnt);
1038 1036
1039 return result; 1037 return result;
1040} 1038}
@@ -1056,8 +1054,7 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1056 1054
1057 if (!nd->path.dentry->d_inode || 1055 if (!nd->path.dentry->d_inode ||
1058 S_ISDIR(nd->path.dentry->d_inode->i_mode)) { 1056 S_ISDIR(nd->path.dentry->d_inode->i_mode)) {
1059 struct dentry *old_dentry = nd->path.dentry; 1057 struct path old_path = nd->path;
1060 struct vfsmount *old_mnt = nd->path.mnt;
1061 struct qstr last = nd->last; 1058 struct qstr last = nd->last;
1062 int last_type = nd->last_type; 1059 int last_type = nd->last_type;
1063 struct fs_struct *fs = current->fs; 1060 struct fs_struct *fs = current->fs;
@@ -1073,14 +1070,12 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1073 read_unlock(&fs->lock); 1070 read_unlock(&fs->lock);
1074 if (path_walk(name, nd) == 0) { 1071 if (path_walk(name, nd) == 0) {
1075 if (nd->path.dentry->d_inode) { 1072 if (nd->path.dentry->d_inode) {
1076 dput(old_dentry); 1073 path_put(&old_path);
1077 mntput(old_mnt);
1078 return 1; 1074 return 1;
1079 } 1075 }
1080 path_put(&nd->path); 1076 path_put(&nd->path);
1081 } 1077 }
1082 nd->path.dentry = old_dentry; 1078 nd->path = old_path;
1083 nd->path.mnt = old_mnt;
1084 nd->last = last; 1079 nd->last = last;
1085 nd->last_type = last_type; 1080 nd->last_type = last_type;
1086 } 1081 }