diff options
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r-- | fs/cifs/readdir.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 887a7e230376..170047cf4522 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -223,33 +223,35 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb, | |||
223 | static int initiate_cifs_search(const int xid, struct file *file) | 223 | static int initiate_cifs_search(const int xid, struct file *file) |
224 | { | 224 | { |
225 | int rc = 0; | 225 | int rc = 0; |
226 | char *full_path; | 226 | char *full_path = NULL; |
227 | struct cifsFileInfo *cifsFile; | 227 | struct cifsFileInfo *cifsFile; |
228 | struct cifs_sb_info *cifs_sb; | 228 | struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
229 | struct tcon_link *tlink; | ||
229 | struct cifsTconInfo *pTcon; | 230 | struct cifsTconInfo *pTcon; |
230 | 231 | ||
231 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 232 | tlink = cifs_sb_tlink(cifs_sb); |
232 | if (cifs_sb == NULL) | 233 | if (IS_ERR(tlink)) |
233 | return -EINVAL; | 234 | return PTR_ERR(tlink); |
235 | pTcon = tlink_tcon(tlink); | ||
234 | 236 | ||
235 | if (file->private_data == NULL) | 237 | if (file->private_data == NULL) |
236 | file->private_data = | 238 | file->private_data = |
237 | kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | 239 | kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); |
240 | if (file->private_data == NULL) { | ||
241 | rc = -ENOMEM; | ||
242 | goto error_exit; | ||
243 | } | ||
238 | 244 | ||
239 | if (file->private_data == NULL) | ||
240 | return -ENOMEM; | ||
241 | cifsFile = file->private_data; | 245 | cifsFile = file->private_data; |
242 | cifsFile->invalidHandle = true; | 246 | cifsFile->invalidHandle = true; |
243 | cifsFile->srch_inf.endOfSearch = false; | 247 | cifsFile->srch_inf.endOfSearch = false; |
244 | cifsFile->tcon = cifs_sb_tcon(cifs_sb); | 248 | cifsFile->tcon = pTcon; |
245 | pTcon = cifsFile->tcon; | ||
246 | if (pTcon == NULL) | ||
247 | return -EINVAL; | ||
248 | 249 | ||
249 | full_path = build_path_from_dentry(file->f_path.dentry); | 250 | full_path = build_path_from_dentry(file->f_path.dentry); |
250 | 251 | if (full_path == NULL) { | |
251 | if (full_path == NULL) | 252 | rc = -ENOMEM; |
252 | return -ENOMEM; | 253 | goto error_exit; |
254 | } | ||
253 | 255 | ||
254 | cFYI(1, "Full path: %s start at: %lld", full_path, file->f_pos); | 256 | cFYI(1, "Full path: %s start at: %lld", full_path, file->f_pos); |
255 | 257 | ||
@@ -282,7 +284,9 @@ ffirst_retry: | |||
282 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; | 284 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; |
283 | goto ffirst_retry; | 285 | goto ffirst_retry; |
284 | } | 286 | } |
287 | error_exit: | ||
285 | kfree(full_path); | 288 | kfree(full_path); |
289 | cifs_put_tlink(tlink); | ||
286 | return rc; | 290 | return rc; |
287 | } | 291 | } |
288 | 292 | ||