]> Git Repo - linux.git/commitdiff
VFS: move BUG_ON test for symlink nd->depth after current->link_count test
authorErez Zadok <[email protected]>
Sat, 21 May 2011 05:19:59 +0000 (01:19 -0400)
committerLinus Torvalds <[email protected]>
Sat, 21 May 2011 07:12:16 +0000 (00:12 -0700)
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 <[email protected]>
Acked-by: Miklos Szeredi <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
fs/namei.c

index e3c4f112ebf754525de7d5634c298e9d4ba4fba8..6ff858c049c030fd5ea1e142a02c39bb4b51a2dc 100644 (file)
@@ -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++;
This page took 0.057635 seconds and 4 git commands to generate.