summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-03-09 16:22:18 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-14 09:15:27 -0400
commit40b39136f07279fdc868a36cba050f4e84ce0ace (patch)
treecd68e514f1b410d034c3b49678d15c352a38d6da /fs/namei.c
parentf374ed5fa8afed8590deaae5dc147422e0e1a6d9 (diff)
path_openat: clean ELOOP handling a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 6972e761286b..ca9a06a65704 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2320,11 +2320,12 @@ static struct file *path_openat(int dfd, const char *pathname,
struct path link = path;
struct inode *linki = link.dentry->d_inode;
void *cookie;
- error = -ELOOP;
- if (!(nd.flags & LOOKUP_FOLLOW))
- goto exit_dput;
- if (count++ == 32)
- goto exit_dput;
+ if (!(nd.flags & LOOKUP_FOLLOW) || count++ == 32) {
+ path_put_conditional(&path, &nd);
+ path_put(&nd.path);
+ filp = ERR_PTR(-ELOOP);
+ break;
+ }
/*
* This is subtle. Instead of calling do_follow_link() we do
* the thing by hands. The reason is that this way we have zero
@@ -2355,9 +2356,6 @@ out:
release_open_intent(&nd);
return filp;
-exit_dput:
- path_put_conditional(&path, &nd);
- path_put(&nd.path);
out_filp:
filp = ERR_PTR(error);
goto out;