]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fix autofs/afs/etc. magic mountpoint breakage
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 23 Dec 2009 04:45:11 +0000 (23:45 -0500)
committerWilly Tarreau <w@1wt.eu>
Sun, 23 Nov 2014 09:55:33 +0000 (10:55 +0100)
We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT)
if /mnt/tmp is an autofs direct mount.  The reason is that nd.last_type
is bogus here; we want LAST_BIND for everything of that kind and we
get LAST_NORM left over from finding parent directory.

So make sure that it *is* set properly; set to LAST_BIND before
doing ->follow_link() - for normal symlinks it will be changed
by __vfs_follow_link() and everything else needs it set that way.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
(cherry picked from commit 86acdca1b63e6890540fa19495cfc708beff3d8b)
[wt: fixes CVE-2014-0203]
Signed-off-by: Willy Tarreau <w@1wt.eu>
fs/namei.c
fs/proc/base.c

index b0afbd427be7abe4f27a3833b5cde21ac5c7d538..0d766d201200f241383a3515e680e55301cd8e01 100644 (file)
@@ -635,6 +635,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
                dget(dentry);
        }
        mntget(path->mnt);
+       nd->last_type = LAST_BIND;
        cookie = dentry->d_inode->i_op->follow_link(dentry, nd);
        error = PTR_ERR(cookie);
        if (!IS_ERR(cookie)) {
index 67f7dc0a4b67f69897b9944da672af0586f59551..c75c5cdadf95e1ef7fd88539c1b564cf2adec6b8 100644 (file)
@@ -1381,7 +1381,6 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
                goto out;
 
        error = PROC_I(inode)->op.proc_get_link(inode, &nd->path);
-       nd->last_type = LAST_BIND;
 out:
        return ERR_PTR(error);
 }