Skip to content

Commit

Permalink
Shift releasing nd->root from do_last() to its caller
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 5, 2010
1 parent fb1cc55 commit 3343eb8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,8 +1685,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
}
filp = nameidata_to_filp(nd);
mnt_drop_write(nd->path.mnt);
if (nd->root.mnt)
path_put(&nd->root);
if (!IS_ERR(filp)) {
error = ima_file_check(filp, acc_mode);
if (error) {
Expand Down Expand Up @@ -1726,8 +1724,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
if (S_ISDIR(path->dentry->d_inode->i_mode))
goto exit;
filp = finish_open(nd, open_flag, flag, acc_mode);
if (nd->root.mnt)
path_put(&nd->root);
return filp;

exit_mutex_unlock:
Expand All @@ -1737,8 +1733,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
exit:
if (!IS_ERR(nd->intent.open.file))
release_open_intent(nd);
if (nd->root.mnt)
path_put(&nd->root);
path_put(&nd->path);
return ERR_PTR(error);
}
Expand Down Expand Up @@ -1857,6 +1851,8 @@ struct file *do_filp_open(int dfd, const char *pathname,
pathname, dir, &is_link);
if (is_link)
goto do_link;
if (nd.root.mnt)
path_put(&nd.root);
return filp;

ok:
Expand Down

0 comments on commit 3343eb8

Please sign in to comment.