diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-24 03:39:50 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-05 09:01:24 -0500 |
commit | a2c36b450ee68470836cb858c58a6ba3a52c5ec5 (patch) | |
tree | 5c1aff4738fd679efd6d96f2ae224ea97121b019 /fs/namei.c | |
parent | c99658fe970f442199733bcace1a00b087336a0d (diff) |
pull more into do_last()
Handling of LAST_DOT/LAST_ROOT/LAST_DOTDOT/terminating slash
can be pulled in as well
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/namei.c b/fs/namei.c index 84f1ec3b4a5d..52517e0bbdde 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1656,6 +1656,10 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1656 | 1656 | ||
1657 | *is_link = 0; | 1657 | *is_link = 0; |
1658 | 1658 | ||
1659 | error = -EISDIR; | ||
1660 | if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) | ||
1661 | goto exit; | ||
1662 | |||
1659 | mutex_lock(&dir->d_inode->i_mutex); | 1663 | mutex_lock(&dir->d_inode->i_mutex); |
1660 | 1664 | ||
1661 | path->dentry = lookup_hash(nd); | 1665 | path->dentry = lookup_hash(nd); |
@@ -1826,13 +1830,8 @@ reval: | |||
1826 | audit_inode(pathname, nd.path.dentry); | 1830 | audit_inode(pathname, nd.path.dentry); |
1827 | 1831 | ||
1828 | /* | 1832 | /* |
1829 | * We have the parent and last component. First of all, check | 1833 | * We have the parent and last component. |
1830 | * that we are not asked to creat(2) an obvious directory - that | ||
1831 | * will not do. | ||
1832 | */ | 1834 | */ |
1833 | error = -EISDIR; | ||
1834 | if (nd.last_type != LAST_NORM || nd.last.name[nd.last.len]) | ||
1835 | goto exit_parent; | ||
1836 | 1835 | ||
1837 | error = -ENFILE; | 1836 | error = -ENFILE; |
1838 | filp = get_empty_filp(); | 1837 | filp = get_empty_filp(); |
@@ -1908,16 +1907,10 @@ do_link: | |||
1908 | nd.flags &= ~LOOKUP_PARENT; | 1907 | nd.flags &= ~LOOKUP_PARENT; |
1909 | if (nd.last_type == LAST_BIND) | 1908 | if (nd.last_type == LAST_BIND) |
1910 | goto ok; | 1909 | goto ok; |
1911 | error = -EISDIR; | ||
1912 | if (nd.last_type != LAST_NORM) | ||
1913 | goto exit; | ||
1914 | if (nd.last.name[nd.last.len]) { | ||
1915 | __putname(nd.last.name); | ||
1916 | goto exit; | ||
1917 | } | ||
1918 | filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode, | 1910 | filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode, |
1919 | pathname, &is_link); | 1911 | pathname, &is_link); |
1920 | __putname(nd.last.name); | 1912 | if (nd.last_type == LAST_NORM) |
1913 | __putname(nd.last.name); | ||
1921 | if (is_link) | 1914 | if (is_link) |
1922 | goto do_link; | 1915 | goto do_link; |
1923 | if (nd.root.mnt) | 1916 | if (nd.root.mnt) |