diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-24 02:02:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-05 09:01:15 -0500 |
commit | 3343eb8209cc69f0d2059f8c484ad7a3e1834c0b (patch) | |
tree | 25d72fd720d5dcbf0f0be40832c76759e49413cc | |
parent | fb1cc555d533869910e20de4b8d5147570afdfad (diff) |
Shift releasing nd->root from do_last() to its caller
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c index 3c39fa1608c5..bff27c08134c 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1685,8 +1685,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1685 | } | 1685 | } |
1686 | filp = nameidata_to_filp(nd); | 1686 | filp = nameidata_to_filp(nd); |
1687 | mnt_drop_write(nd->path.mnt); | 1687 | mnt_drop_write(nd->path.mnt); |
1688 | if (nd->root.mnt) | ||
1689 | path_put(&nd->root); | ||
1690 | if (!IS_ERR(filp)) { | 1688 | if (!IS_ERR(filp)) { |
1691 | error = ima_file_check(filp, acc_mode); | 1689 | error = ima_file_check(filp, acc_mode); |
1692 | if (error) { | 1690 | if (error) { |
@@ -1726,8 +1724,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1726 | if (S_ISDIR(path->dentry->d_inode->i_mode)) | 1724 | if (S_ISDIR(path->dentry->d_inode->i_mode)) |
1727 | goto exit; | 1725 | goto exit; |
1728 | filp = finish_open(nd, open_flag, flag, acc_mode); | 1726 | filp = finish_open(nd, open_flag, flag, acc_mode); |
1729 | if (nd->root.mnt) | ||
1730 | path_put(&nd->root); | ||
1731 | return filp; | 1727 | return filp; |
1732 | 1728 | ||
1733 | exit_mutex_unlock: | 1729 | exit_mutex_unlock: |
@@ -1737,8 +1733,6 @@ exit_dput: | |||
1737 | exit: | 1733 | exit: |
1738 | if (!IS_ERR(nd->intent.open.file)) | 1734 | if (!IS_ERR(nd->intent.open.file)) |
1739 | release_open_intent(nd); | 1735 | release_open_intent(nd); |
1740 | if (nd->root.mnt) | ||
1741 | path_put(&nd->root); | ||
1742 | path_put(&nd->path); | 1736 | path_put(&nd->path); |
1743 | return ERR_PTR(error); | 1737 | return ERR_PTR(error); |
1744 | } | 1738 | } |
@@ -1857,6 +1851,8 @@ do_last: | |||
1857 | pathname, dir, &is_link); | 1851 | pathname, dir, &is_link); |
1858 | if (is_link) | 1852 | if (is_link) |
1859 | goto do_link; | 1853 | goto do_link; |
1854 | if (nd.root.mnt) | ||
1855 | path_put(&nd.root); | ||
1860 | return filp; | 1856 | return filp; |
1861 | 1857 | ||
1862 | ok: | 1858 | ok: |