]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] missing check in do_add_mount()
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Thu, 18 Mar 2004 13:38:43 +0000 (05:38 -0800)
committerDavid S. Miller <davem@nuts.davemloft.net>
Thu, 18 Mar 2004 13:38:43 +0000 (05:38 -0800)
Make sure that we don't end up with symlink mounted over something

(mount --bind is safe since we use LOOKUP_FOLLOW in pathname resolution
there).

fs/namespace.c

index c2b8d730e6088b046e6c01bda2312b057ee32355..e29f147fa274c2d3c140d0070bfae95b7b4a3429 100644 (file)
@@ -681,6 +681,10 @@ static int do_add_mount(struct nameidata *nd, char *type, int flags,
        if (nd->mnt->mnt_sb == mnt->mnt_sb && nd->mnt->mnt_root == nd->dentry)
                goto unlock;
 
+       err = -EINVAL;
+       if (S_ISLNK(mnt->mnt_root->d_inode->i_mode))
+               goto unlock;
+
        mnt->mnt_flags = mnt_flags;
        err = graft_tree(mnt, nd);
 unlock: