aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorErez Zadok <ezk@fsl.cs.sunysb.edu>2011-05-21 01:19:59 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-03 09:31:47 +0900
commit084013b8e040a1414f83e5574d2716019c180a11 (patch)
tree9157d914fc8aead4f93b81e2ba0a1ff16ad473c7 /fs
parent05e9a48acf36b2b8ded09d4c630ec4671de713db (diff)
VFS: move BUG_ON test for symlink nd->depth after current->link_count test
commit 1a4022f88d40e1255920b017556092ab926d7f66 upstream. This solves a serious VFS-level bug in nested_symlink (which was rewritten from do_follow_link), and follows the order of depth tests that existed before. The bug triggers a BUG_ON in fs/namei.c:1381, when running racer with symlink and rename ops. Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu> Acked-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index e3c4f112ebf..6ff858c049c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1378,12 +1378,12 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd)
{
int res;
- BUG_ON(nd->depth >= MAX_NESTED_LINKS);
if (unlikely(current->link_count >= MAX_NESTED_LINKS)) {
path_put_conditional(path, nd);
path_put(&nd->path);
return -ELOOP;
}
+ BUG_ON(nd->depth >= MAX_NESTED_LINKS);
nd->depth++;
current->link_count++;