diff options
author | J. R. Okajima <hooanon05@yahoo.co.jp> | 2009-06-18 10:30:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-06-24 08:15:24 -0400 |
commit | 654f562c526cf9dfb8d453f687341fe0777ee454 (patch) | |
tree | 407b4c7755b6db7ecf77a881121228831876ee55 /fs/namei.c | |
parent | b5450d9c84bdd38b261922057cd167da51dfae93 (diff) |
vfs: fix nd->root leak in do_filp_open()
commit 2a737871108de9ba8930f7650d549f1383767f8b "Cache root in nameidata"
introduced a new member nd->root, but forgot to put it in do_filp_open().
Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c index 527119afb6a5..5b961eb71cbf 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1698,8 +1698,11 @@ struct file *do_filp_open(int dfd, const char *pathname, | |||
1698 | if (error) | 1698 | if (error) |
1699 | return ERR_PTR(error); | 1699 | return ERR_PTR(error); |
1700 | error = path_walk(pathname, &nd); | 1700 | error = path_walk(pathname, &nd); |
1701 | if (error) | 1701 | if (error) { |
1702 | if (nd.root.mnt) | ||
1703 | path_put(&nd.root); | ||
1702 | return ERR_PTR(error); | 1704 | return ERR_PTR(error); |
1705 | } | ||
1703 | if (unlikely(!audit_dummy_context())) | 1706 | if (unlikely(!audit_dummy_context())) |
1704 | audit_inode(pathname, nd.path.dentry); | 1707 | audit_inode(pathname, nd.path.dentry); |
1705 | 1708 | ||
@@ -1759,6 +1762,8 @@ do_last: | |||
1759 | } | 1762 | } |
1760 | filp = nameidata_to_filp(&nd, open_flag); | 1763 | filp = nameidata_to_filp(&nd, open_flag); |
1761 | mnt_drop_write(nd.path.mnt); | 1764 | mnt_drop_write(nd.path.mnt); |
1765 | if (nd.root.mnt) | ||
1766 | path_put(&nd.root); | ||
1762 | return filp; | 1767 | return filp; |
1763 | } | 1768 | } |
1764 | 1769 | ||
@@ -1819,6 +1824,8 @@ ok: | |||
1819 | */ | 1824 | */ |
1820 | if (will_write) | 1825 | if (will_write) |
1821 | mnt_drop_write(nd.path.mnt); | 1826 | mnt_drop_write(nd.path.mnt); |
1827 | if (nd.root.mnt) | ||
1828 | path_put(&nd.root); | ||
1822 | return filp; | 1829 | return filp; |
1823 | 1830 | ||
1824 | exit_mutex_unlock: | 1831 | exit_mutex_unlock: |
@@ -1859,6 +1866,8 @@ do_link: | |||
1859 | * with "intent.open". | 1866 | * with "intent.open". |
1860 | */ | 1867 | */ |
1861 | release_open_intent(&nd); | 1868 | release_open_intent(&nd); |
1869 | if (nd.root.mnt) | ||
1870 | path_put(&nd.root); | ||
1862 | return ERR_PTR(error); | 1871 | return ERR_PTR(error); |
1863 | } | 1872 | } |
1864 | nd.flags &= ~LOOKUP_PARENT; | 1873 | nd.flags &= ~LOOKUP_PARENT; |