diff options
-rw-r--r-- | fs/namei.c | 11 | ||||
-rw-r--r-- | fs/pipe.c | 10 |
2 files changed, 9 insertions, 12 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 && |
@@ -1003,8 +1003,7 @@ struct file *create_write_pipe(void) | |||
1003 | void free_write_pipe(struct file *f) | 1003 | void free_write_pipe(struct file *f) |
1004 | { | 1004 | { |
1005 | free_pipe_info(f->f_dentry->d_inode); | 1005 | free_pipe_info(f->f_dentry->d_inode); |
1006 | dput(f->f_path.dentry); | 1006 | path_put(&f->f_path); |
1007 | mntput(f->f_path.mnt); | ||
1008 | put_filp(f); | 1007 | put_filp(f); |
1009 | } | 1008 | } |
1010 | 1009 | ||
@@ -1015,8 +1014,8 @@ struct file *create_read_pipe(struct file *wrf) | |||
1015 | return ERR_PTR(-ENFILE); | 1014 | return ERR_PTR(-ENFILE); |
1016 | 1015 | ||
1017 | /* Grab pipe from the writer */ | 1016 | /* Grab pipe from the writer */ |
1018 | f->f_path.mnt = mntget(wrf->f_path.mnt); | 1017 | f->f_path = wrf->f_path; |
1019 | f->f_path.dentry = dget(wrf->f_path.dentry); | 1018 | path_get(&wrf->f_path); |
1020 | f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping; | 1019 | f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping; |
1021 | 1020 | ||
1022 | f->f_pos = 0; | 1021 | f->f_pos = 0; |
@@ -1068,8 +1067,7 @@ int do_pipe(int *fd) | |||
1068 | err_fdr: | 1067 | err_fdr: |
1069 | put_unused_fd(fdr); | 1068 | put_unused_fd(fdr); |
1070 | err_read_pipe: | 1069 | err_read_pipe: |
1071 | dput(fr->f_dentry); | 1070 | path_put(&fr->f_path); |
1072 | mntput(fr->f_vfsmnt); | ||
1073 | put_filp(fr); | 1071 | put_filp(fr); |
1074 | err_write_pipe: | 1072 | err_write_pipe: |
1075 | free_write_pipe(fw); | 1073 | free_write_pipe(fw); |