]> git.baikalelectronics.ru Git - kernel.git/commit
ksmbd: fix incorrect handling of iterate_dir
authorNamjae Jeon <linkinjeon@kernel.org>
Fri, 9 Sep 2022 08:43:53 +0000 (17:43 +0900)
committerSteve French <stfrench@microsoft.com>
Wed, 5 Oct 2022 06:15:37 +0000 (01:15 -0500)
commit65438457af40d4d48ecd90afe4d5988f2da6fce1
tree50ba047c664ad9060599fe4d73e9fe27ebf4cf83
parent6773bf6d3d8cf7299ce3ac67341ecf91d37a5535
ksmbd: fix incorrect handling of iterate_dir

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(). And if iterate_dir() return -EIO, which mean
directory entry is corrupted, return STATUS_FILE_CORRUPT_ERROR error
response.

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

Fixes: 9445e1eebdb7 ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/smb2pdu.c