diff options
author | Namjae Jeon <linkinjeon@kernel.org> | 2023-10-09 23:58:15 +0900 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-10-12 22:44:05 -0500 |
commit | be0f89d4419dc5413a1cf06db3671c9949be0d52 (patch) | |
tree | 0111b447baa724d6e0a153e227cdc3d95faeaacd /fs | |
parent | f43328357defc0dc9d28dbd06dc3361fd2b22e28 (diff) | |
download | linux-stable-be0f89d4419dc5413a1cf06db3671c9949be0d52.tar.gz linux-stable-be0f89d4419dc5413a1cf06db3671c9949be0d52.tar.bz2 linux-stable-be0f89d4419dc5413a1cf06db3671c9949be0d52.zip |
ksmbd: fix wrong error response status by using set_smb2_rsp_status()
set_smb2_rsp_status() after __process_request() sets the wrong error
status. This patch resets all iov vectors and sets the error status
on clean one.
Fixes: e2b76ab8b5c9 ("ksmbd: add support for read compound")
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/smb/server/smb2pdu.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 898860adf929..87c6401a6007 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -231,11 +231,12 @@ void set_smb2_rsp_status(struct ksmbd_work *work, __le32 err) { struct smb2_hdr *rsp_hdr; - if (work->next_smb2_rcv_hdr_off) - rsp_hdr = ksmbd_resp_buf_next(work); - else - rsp_hdr = smb2_get_msg(work->response_buf); + rsp_hdr = smb2_get_msg(work->response_buf); rsp_hdr->Status = err; + + work->iov_idx = 0; + work->iov_cnt = 0; + work->next_smb2_rcv_hdr_off = 0; smb2_set_err_rsp(work); } |