All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.6.39/40 kernel BUG at fs/namei.c:1381
@ 2011-05-21  5:19 Erez Zadok
  2011-05-21 22:27 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Erez Zadok @ 2011-05-21  5:19 UTC (permalink / raw)
  To: Linus Torvalds, akpm, Al Viro, Christoph Hellwig; +Cc: linux-fsdevel, stable

VFS: move BUG_ON test for symlink nd->depth after current->link_count test

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>
CC: stable@kernel.org
diff --git a/fs/namei.c b/fs/namei.c
index 017c3fa..7a93387 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1343,12 +1343,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++;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-21 22:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-21  5:19 [PATCH] 2.6.39/40 kernel BUG at fs/namei.c:1381 Erez Zadok
2011-05-21 22:27 ` Al Viro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.