diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c index c7e43536c49a..ee1544696e83 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 && |