Skip to content

Commit

Permalink
ksmbd: fix wrong error response status by using set_smb2_rsp_status()
Browse files Browse the repository at this point in the history
[ Upstream commit be0f89d ]

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: e2b76ab ("ksmbd: add support for read compound")
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
namjaejeon authored and gregkh committed Jan 5, 2024
1 parent 7b58ee8 commit 943cebf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/smb/server/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,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);
}

Expand Down

0 comments on commit 943cebf

Please sign in to comment.