]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] namespace.c fix
authorAndries E. Brouwer <andries.brouwer@cwi.nl>
Sun, 25 May 2003 08:20:42 +0000 (01:20 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 25 May 2003 08:20:42 +0000 (01:20 -0700)
Yet another one in the namespace.c series.

The code in graft_tree() used to be correct, but the code

        err = -ENOENT;
        down(&nd->dentry->d_inode->i_sem);
        if (IS_DEADDIR(nd->dentry->d_inode))
                goto out_unlock;

        spin_lock(&dcache_lock);
        if (IS_ROOT(nd->dentry) || !d_unhashed(nd->dentry)) {
...
}
spin_unlock(&dcache_lock);
 out_unlock:

was made incorrect in 2.5.29 when

        err = security_sb_check_sb(mnt, nd);
        if (err)
                goto out_unlock;

was inserted.  It has happened more often that people overlooked
a preexisting setting of err.

fs/namespace.c

index 09238867b43b5f5e390a6d1bd45e4a2ce52b2e2e..0174d8400c9d1ec1a5aa5f66193f4c9ed9cae087 100644 (file)
@@ -486,9 +486,11 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
        if (err)
                goto out_unlock;
 
+       err = -ENOENT;
        spin_lock(&dcache_lock);
        if (IS_ROOT(nd->dentry) || !d_unhashed(nd->dentry)) {
                struct list_head head;
+
                attach_mnt(mnt, nd);
                list_add_tail(&head, &mnt->mnt_list);
                list_splice(&head, current->namespace->list.prev);