Skip to content

Commit af111b3

Browse files
committed
ksmbd: fix infinite loop when client send search patten
MacOS send search patten in smb2 query_dir. If there is no file that matched with search patten, d_info.num_entry is zero. This causes it to retry iterate_dir(), which leads to an infinite loop. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent f4fd582 commit af111b3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

smb2pdu.c

+1
Original file line numberDiff line numberDiff line change
@@ -4664,6 +4664,7 @@ int smb2_query_dir(struct ksmbd_work *work)
46644664
set_ctx_actor(&dir_fp->readdir_data.ctx, __query_dir);
46654665

46664666
again:
4667+
d_info.num_scan = 0;
46674668
rc = iterate_dir(dir_fp->filp, &dir_fp->readdir_data.ctx);
46684669
/*
46694670
* num_entry can be 0 if the directory iteration stops before reaching

0 commit comments

Comments
 (0)