Skip to content

Commit 6f9202e

Browse files
committed
ksmbd: fix
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent f4fd582 commit 6f9202e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

smb2pdu.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -4560,7 +4560,7 @@ int smb2_query_dir(struct ksmbd_work *work)
45604560
int rc = 0;
45614561
char *srch_ptr = NULL;
45624562
unsigned char srch_flag;
4563-
int buffer_sz;
4563+
int buffer_sz, prev_num_scan = 0;
45644564
struct smb2_query_dir_private query_dir_private = {NULL, };
45654565

45664566
ksmbd_debug(SMB, "Received smb2 query directory request\n");
@@ -4670,9 +4670,12 @@ int smb2_query_dir(struct ksmbd_work *work)
46704670
* the end of the directory and no file is matched with the search
46714671
* pattern.
46724672
*/
4673-
if (rc >= 0 && !d_info.num_entry && d_info.num_scan &&
4674-
d_info.out_buf_len > 0)
4673+
if (rc >= 0 && !d_info.num_entry &&
4674+
(d_info.num_scan && d_info.num_scan != prev_num_scan) &&
4675+
d_info.out_buf_len > 0) {
4676+
prev_num_scan = d_info.num_scan;
46754677
goto again;
4678+
}
46764679
/*
46774680
* req->OutputBufferLength is too small to contain even one entry.
46784681
* In this case, it immediately returns OutputBufferLength 0 to client.

0 commit comments

Comments
 (0)