summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-12-24 09:39:50 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2010-03-05 15:01:24 +0100
commita2c36b450ee68470836cb858c58a6ba3a52c5ec5 (patch)
tree5c1aff4738fd679efd6d96f2ae224ea97121b019 /fs/namei.c
parentbail out with ELOOP earlier in do_link loop (diff)
downloadlinux-a2c36b450ee68470836cb858c58a6ba3a52c5ec5.tar.xz
linux-a2c36b450ee68470836cb858c58a6ba3a52c5ec5.zip
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 '')
-rw-r--r--fs/namei.c21
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,
*is_link = 0;
+ error = -EISDIR;
+ if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len])
+ goto exit;
+
mutex_lock(&dir->d_inode->i_mutex);
path->dentry = lookup_hash(nd);
@@ -1826,13 +1830,8 @@ reval:
audit_inode(pathname, nd.path.dentry);
/*
- * We have the parent and last component. First of all, check
- * that we are not asked to creat(2) an obvious directory - that
- * will not do.
+ * We have the parent and last component.
*/
- error = -EISDIR;
- if (nd.last_type != LAST_NORM || nd.last.name[nd.last.len])
- goto exit_parent;
error = -ENFILE;
filp = get_empty_filp();
@@ -1908,16 +1907,10 @@ do_link:
nd.flags &= ~LOOKUP_PARENT;
if (nd.last_type == LAST_BIND)
goto ok;
- error = -EISDIR;
- if (nd.last_type != LAST_NORM)
- goto exit;
- if (nd.last.name[nd.last.len]) {
- __putname(nd.last.name);
- goto exit;
- }
filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode,
pathname, &is_link);
- __putname(nd.last.name);
+ if (nd.last_type == LAST_NORM)
+ __putname(nd.last.name);
if (is_link)
goto do_link;
if (nd.root.mnt)