Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] ksmbd: fix incorrect handling of iterate_dir
@ 2022-08-19  4:35 Hyunchul Lee
  2022-08-22  0:51 ` Namjae Jeon
  0 siblings, 1 reply; 12+ messages in thread
From: Hyunchul Lee @ 2022-08-19  4:35 UTC (permalink / raw)
  To: linux-cifs; +Cc: Namjae Jeon, Steve French, Sergey Senozhatsky

if iterate_dir() returns non-negative value,
caller has to treat it as normal and
check there is any error while populating
dentry information. ksmbd doesn't have to
do anything because ksmbd already
checks too small OutputBufferLength to
store one file information.

And because ctx->pos is set to file->f_pos
when iterative_dir is called, remove
restart_ctx().

This patch fixes some failure of
SMB2_QUERY_DIRECTORY, which happens when
ntfs3 is local filesystem.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
---
 fs/ksmbd/smb2pdu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 53c91ab02be2..6716c4e3c16d 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -3970,11 +3970,9 @@ int smb2_query_dir(struct ksmbd_work *work)
 	 */
 	if (!d_info.out_buf_len && !d_info.num_entry)
 		goto no_buf_len;
-	if (rc == 0)
-		restart_ctx(&dir_fp->readdir_data.ctx);
-	if (rc == -ENOSPC)
+	if (rc > 0 || rc == -ENOSPC)
 		rc = 0;
-	if (rc)
+	else if (rc)
 		goto err_out;
 
 	d_info.wptr = d_info.rptr;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-08-31 23:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-19  4:35 [PATCH] ksmbd: fix incorrect handling of iterate_dir Hyunchul Lee
2022-08-22  0:51 ` Namjae Jeon
2022-08-22  2:14   ` Hyunchul Lee
2022-08-22  2:47     ` Namjae Jeon
2022-08-22  6:24       ` Hyunchul Lee
2022-08-23  0:40         ` Namjae Jeon
2022-08-23  2:32           ` Hyunchul Lee
2022-08-23  2:45             ` Namjae Jeon
2022-08-23  8:26               ` Hyunchul Lee
2022-08-24  0:10                 ` Namjae Jeon
2022-08-31  7:06                   ` Hyunchul Lee
2022-08-31 23:36                     ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox