diff options
author | Namjae Jeon | 2023-11-07 21:04:31 +0900 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-11-28 17:07:10 +0000 |
commit | 482aaa72f95032b0c2ff40cd37a9f3623e185fad (patch) | |
tree | 49ef7df3f3ca7e75c1b67c9fbb296c3a196d8349 /fs/smb/server | |
parent | 8e76941a1672551f651a6bcfeb1fab2817e1cc3a (diff) |
ksmbd: handle malformed smb1 message
commit 5a5409d90bd05f87fe5623a749ccfbf3f7c7d400 upstream.
If set_smb1_rsp_status() is not implemented, It will cause NULL pointer
dereferece error when client send malformed smb1 message.
This patch add set_smb1_rsp_status() to ignore malformed smb1 message.
Cc: stable@vger.kernel.org
Reported-by: Robert Morris <rtm@csail.mit.edu>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/smb/server')
-rw-r--r-- | fs/smb/server/smb_common.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c index a4421d9458d9..adc41b57b84c 100644 --- a/fs/smb/server/smb_common.c +++ b/fs/smb/server/smb_common.c @@ -372,11 +372,22 @@ static int smb1_allocate_rsp_buf(struct ksmbd_work *work) return 0; } +/** + * set_smb1_rsp_status() - set error type in smb response header + * @work: smb work containing smb response header + * @err: error code to set in response + */ +static void set_smb1_rsp_status(struct ksmbd_work *work, __le32 err) +{ + work->send_no_response = 1; +} + static struct smb_version_ops smb1_server_ops = { .get_cmd_val = get_smb1_cmd_val, .init_rsp_hdr = init_smb1_rsp_hdr, .allocate_rsp_buf = smb1_allocate_rsp_buf, .check_user_session = smb1_check_user_session, + .set_rsp_status = set_smb1_rsp_status, }; static int smb1_negotiate(struct ksmbd_work *work) |