summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-12-24 02:02:38 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2010-03-05 09:01:15 -0500
commit3343eb8209cc69f0d2059f8c484ad7a3e1834c0b (patch)
tree25d72fd720d5dcbf0f0be40832c76759e49413cc /fs
parentfb1cc555d533869910e20de4b8d5147570afdfad (diff)
Shift releasing nd->root from do_last() to its caller
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 3c39fa1608c..bff27c08134 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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) {
@@ -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:
@@ -1737,8 +1733,6 @@ exit_dput:
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);
}
@@ -1857,6 +1851,8 @@ do_last:
pathname, dir, &is_link);
if (is_link)
goto do_link;
+ if (nd.root.mnt)
+ path_put(&nd.root);
return filp;
ok: