diff options
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r-- | fs/cifs/readdir.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 6a8b417babab..d7784a95134f 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -228,22 +228,21 @@ static int initiate_cifs_search(const int xid, struct file *file) | |||
228 | struct cifs_sb_info *cifs_sb; | 228 | struct cifs_sb_info *cifs_sb; |
229 | struct cifsTconInfo *pTcon; | 229 | struct cifsTconInfo *pTcon; |
230 | 230 | ||
231 | if (file->private_data == NULL) { | 231 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
232 | if (cifs_sb == NULL) | ||
233 | return -EINVAL; | ||
234 | |||
235 | if (file->private_data == NULL) | ||
232 | file->private_data = | 236 | file->private_data = |
233 | kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | 237 | kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); |
234 | } | ||
235 | 238 | ||
236 | if (file->private_data == NULL) | 239 | if (file->private_data == NULL) |
237 | return -ENOMEM; | 240 | return -ENOMEM; |
238 | cifsFile = file->private_data; | 241 | cifsFile = file->private_data; |
239 | cifsFile->invalidHandle = true; | 242 | cifsFile->invalidHandle = true; |
240 | cifsFile->srch_inf.endOfSearch = false; | 243 | cifsFile->srch_inf.endOfSearch = false; |
241 | 244 | cifsFile->tcon = cifs_sb->tcon; | |
242 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 245 | pTcon = cifsFile->tcon; |
243 | if (cifs_sb == NULL) | ||
244 | return -EINVAL; | ||
245 | |||
246 | pTcon = cifs_sb->tcon; | ||
247 | if (pTcon == NULL) | 246 | if (pTcon == NULL) |
248 | return -EINVAL; | 247 | return -EINVAL; |
249 | 248 | ||
@@ -786,9 +785,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
786 | xid = GetXid(); | 785 | xid = GetXid(); |
787 | 786 | ||
788 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 787 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
789 | pTcon = cifs_sb->tcon; | ||
790 | if (pTcon == NULL) | ||
791 | return -EINVAL; | ||
792 | 788 | ||
793 | switch ((int) file->f_pos) { | 789 | switch ((int) file->f_pos) { |
794 | case 0: | 790 | case 0: |
@@ -838,6 +834,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
838 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 834 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
839 | } */ | 835 | } */ |
840 | 836 | ||
837 | pTcon = cifsFile->tcon; | ||
841 | rc = find_cifs_entry(xid, pTcon, file, | 838 | rc = find_cifs_entry(xid, pTcon, file, |
842 | ¤t_entry, &num_to_fill); | 839 | ¤t_entry, &num_to_fill); |
843 | if (rc) { | 840 | if (rc) { |