From: Hyunchul Lee <hyc.lee@gmail.com>
To: linux-cifs <linux-cifs@vger.kernel.org>
Cc: Namjae Jeon <linkinjeon@kernel.org>,
Steve French <smfrench@gmail.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: [PATCH] ksmbd: fix incorrect handling of iterate_dir
Date: Fri, 19 Aug 2022 13:35:57 +0900 [thread overview]
Message-ID: <20220819043557.26745-1-hyc.lee@gmail.com> (raw)
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
next reply other threads:[~2022-08-19 4:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 4:35 Hyunchul Lee [this message]
2022-08-22 0:51 ` [PATCH] ksmbd: fix incorrect handling of iterate_dir 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220819043557.26745-1-hyc.lee@gmail.com \
--to=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox