Skip to content

Commit

Permalink
path_openat: clean ELOOP handling a bit
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Mar 14, 2011
1 parent f374ed5 commit 40b3913
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2355,9 +2356,6 @@ static struct file *path_openat(int dfd, const char *pathname,
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;
Expand Down

0 comments on commit 40b3913

Please sign in to comment.