aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/readdir.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 34ec32100c72..713c25110197 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -670,8 +670,11 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
670 (index_to_find < first_entry_in_buffer)) { 670 (index_to_find < first_entry_in_buffer)) {
671 /* close and restart search */ 671 /* close and restart search */
672 cFYI(1, ("search backing up - close and restart search")); 672 cFYI(1, ("search backing up - close and restart search"));
673 cifsFile->invalidHandle = true; 673 if (!cifsFile->srch_inf.endOfSearch &&
674 CIFSFindClose(xid, pTcon, cifsFile->netfid); 674 !cifsFile->invalidHandle) {
675 cifsFile->invalidHandle = true;
676 CIFSFindClose(xid, pTcon, cifsFile->netfid);
677 }
675 kfree(cifsFile->search_resume_name); 678 kfree(cifsFile->search_resume_name);
676 cifsFile->search_resume_name = NULL; 679 cifsFile->search_resume_name = NULL;
677 if (cifsFile->srch_inf.ntwrk_buf_start) { 680 if (cifsFile->srch_inf.ntwrk_buf_start) {