Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
[pandora-kernel.git] / fs / smbfs / dir.c
index 0424d06..b1e58d1 100644 (file)
@@ -34,7 +34,7 @@ static int smb_rename(struct inode *, struct dentry *,
 static int smb_make_node(struct inode *,struct dentry *,int,dev_t);
 static int smb_link(struct dentry *, struct inode *, struct dentry *);
 
-struct file_operations smb_dir_operations =
+const struct file_operations smb_dir_operations =
 {
        .read           = generic_read_dir,
        .readdir        = smb_readdir,
@@ -78,7 +78,7 @@ struct inode_operations smb_dir_inode_operations_unix =
 static int 
 smb_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct dentry *dentry = filp->f_dentry;
+       struct dentry *dentry = filp->f_path.dentry;
        struct inode *dir = dentry->d_inode;
        struct smb_sb_info *server = server_from_dentry(dentry);
        union  smb_dir_cache *cache = NULL;
@@ -238,12 +238,12 @@ out:
 static int
 smb_dir_open(struct inode *dir, struct file *file)
 {
-       struct dentry *dentry = file->f_dentry;
+       struct dentry *dentry = file->f_path.dentry;
        struct smb_sb_info *server;
        int error = 0;
 
        VERBOSE("(%s/%s)\n", dentry->d_parent->d_name.name,
-               file->f_dentry->d_name.name);
+               file->f_path.dentry->d_name.name);
 
        /*
         * Directory timestamps in the core protocol aren't updated
@@ -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