summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 976fc323272..84f1ec3b4a5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1873,7 +1873,7 @@ exit_parent:
do_link:
error = -ELOOP;
- if (flag & O_NOFOLLOW)
+ if ((flag & O_NOFOLLOW) || count++ == 32)
goto exit_dput;
/*
* This is subtle. Instead of calling do_follow_link() we do the
@@ -1915,11 +1915,6 @@ do_link:
__putname(nd.last.name);
goto exit;
}
- error = -ELOOP;
- if (count++==32) {
- __putname(nd.last.name);
- goto exit;
- }
filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode,
pathname, &is_link);
__putname(nd.last.name);