]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 24 Nov 2022 13:25:52 +0000 (14:25 +0100)
commitd8ec7f831bbfa26d989010c431820bedb0515dab
tree40b3e79c915e6f846a5fed5a9c40c641a54f904c
parent3e77186167fac544a4b31768d38e1a5e8587aa3c
ksmbd: fix incorrect handling of iterate_dir

BugLink: https://bugs.launchpad.net/bugs/1997113
[ Upstream commit 88541cb414b7a2450c45fc9c131b37b5753b7679 ]

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: e2f34481b24d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/ksmbd/smb2pdu.c