diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/namei.c b/fs/namei.c index c7e43536c49a..01e67dddcc3d 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -581,15 +581,13 @@ static __always_inline int link_path_walk(const char *name, struct nameidata *nd | |||
581 | int result; | 581 | int result; |
582 | 582 | ||
583 | /* make sure the stuff we saved doesn't go away */ | 583 | /* make sure the stuff we saved doesn't go away */ |
584 | dget(save.dentry); | 584 | path_get(&save); |
585 | mntget(save.mnt); | ||
586 | 585 | ||
587 | result = __link_path_walk(name, nd); | 586 | result = __link_path_walk(name, nd); |
588 | if (result == -ESTALE) { | 587 | if (result == -ESTALE) { |
589 | /* nd->path had been dropped */ | 588 | /* nd->path had been dropped */ |
590 | nd->path = save; | 589 | nd->path = save; |
591 | dget(nd->path.dentry); | 590 | path_get(&nd->path); |
592 | mntget(nd->path.mnt); | ||
593 | nd->flags |= LOOKUP_REVAL; | 591 | nd->flags |= LOOKUP_REVAL; |
594 | result = __link_path_walk(name, nd); | 592 | result = __link_path_walk(name, nd); |
595 | } | 593 | } |
@@ -1216,8 +1214,9 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, | |||
1216 | nd->flags = flags; | 1214 | nd->flags = flags; |
1217 | nd->depth = 0; | 1215 | nd->depth = 0; |
1218 | 1216 | ||
1219 | nd->path.mnt = mntget(mnt); | 1217 | nd->path.dentry = dentry; |
1220 | nd->path.dentry = dget(dentry); | 1218 | nd->path.mnt = mnt; |
1219 | path_get(&nd->path); | ||
1221 | 1220 | ||
1222 | retval = path_walk(name, nd); | 1221 | retval = path_walk(name, nd); |
1223 | if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && | 1222 | if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && |
@@ -2857,16 +2856,17 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) | |||
2857 | { | 2856 | { |
2858 | struct nameidata nd; | 2857 | struct nameidata nd; |
2859 | void *cookie; | 2858 | void *cookie; |
2859 | int res; | ||
2860 | 2860 | ||
2861 | nd.depth = 0; | 2861 | nd.depth = 0; |
2862 | cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); | 2862 | cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); |
2863 | if (!IS_ERR(cookie)) { | 2863 | if (IS_ERR(cookie)) |
2864 | int res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); | 2864 | return PTR_ERR(cookie); |
2865 | if (dentry->d_inode->i_op->put_link) | 2865 | |
2866 | dentry->d_inode->i_op->put_link(dentry, &nd, cookie); | 2866 | res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); |
2867 | cookie = ERR_PTR(res); | 2867 | if (dentry->d_inode->i_op->put_link) |
2868 | } | 2868 | dentry->d_inode->i_op->put_link(dentry, &nd, cookie); |
2869 | return PTR_ERR(cookie); | 2869 | return res; |
2870 | } | 2870 | } |
2871 | 2871 | ||
2872 | int vfs_follow_link(struct nameidata *nd, const char *link) | 2872 | int vfs_follow_link(struct nameidata *nd, const char *link) |