Skip to content

Commit

Permalink
ksmbd: fix infinite loop when client send search patten
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
namjaejeon committed Feb 12, 2025
1 parent 4c27c3b commit d636ecf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4664,6 +4664,7 @@ int smb2_query_dir(struct ksmbd_work *work)
set_ctx_actor(&dir_fp->readdir_data.ctx, __query_dir);

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

0 comments on commit d636ecf

Please sign in to comment.