]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] smbfs chroot issue (CVE-2006-1864)
authorOlaf Kirch <okir@suse.de>
Thu, 4 May 2006 04:30:11 +0000 (21:30 -0700)
committerChris Wright <chrisw@sous-sol.org>
Fri, 5 May 2006 00:03:36 +0000 (17:03 -0700)
Mark Moseley reported that a chroot environment on a SMB share can be
left via "cd ..\\".  Similar to CVE-2006-1863 issue with cifs, this fix
is for smbfs.

Steven French <sfrench@us.ibm.com> wrote:

Looks fine to me.  This should catch the slash on lookup or equivalent,
which will be all obvious paths of interest.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
fs/smbfs/dir.c

index 0424d06b147e3832273b068f2389b99057c28e0a..45862eca8456cc29e1db4f9af9f5ddc83193d996 100644 (file)
@@ -434,6 +434,11 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
        if (dentry->d_name.len > SMB_MAXNAMELEN)
                goto out;
 
+       /* Do not allow lookup of names with backslashes in */
+       error = -EINVAL;
+       if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
+               goto out;
+
        lock_kernel();
        error = smb_proc_getattr(dentry, &finfo);
 #ifdef SMBFS_PARANOIA