X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=fs%2Fsmbfs%2Fdir.c;h=50136b1a3eca126d92bbb66b94c90a4f7ba0f6ad;hb=2d3466a348a61c4d7f958ce80020eba17c09d7f7;hp=34c7a11d91f0ebbb29854a0116d8c558825fbbbc;hpb=86579dd06deecfa6ac88d5e84e4d63c397cd6f6d;p=linux-2.6-omap-h63xx.git diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c index 34c7a11d91f..50136b1a3ec 100644 --- a/fs/smbfs/dir.c +++ b/fs/smbfs/dir.c @@ -42,7 +42,7 @@ const struct file_operations smb_dir_operations = .open = smb_dir_open, }; -struct inode_operations smb_dir_inode_operations = +const struct inode_operations smb_dir_inode_operations = { .create = smb_create, .lookup = smb_lookup, @@ -54,7 +54,7 @@ struct inode_operations smb_dir_inode_operations = .setattr = smb_notify_change, }; -struct inode_operations smb_dir_inode_operations_unix = +const struct inode_operations smb_dir_inode_operations_unix = { .create = smb_create, .lookup = smb_lookup, @@ -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