Commit 5a5409d9 authored by Namjae Jeon's avatar Namjae Jeon Committed by Steve French

ksmbd: handle malformed smb1 message

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: default avatarRobert Morris <rtm@csail.mit.edu>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent f6049712
...@@ -366,11 +366,22 @@ static int smb1_allocate_rsp_buf(struct ksmbd_work *work) ...@@ -366,11 +366,22 @@ static int smb1_allocate_rsp_buf(struct ksmbd_work *work)
return 0; 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 = { static struct smb_version_ops smb1_server_ops = {
.get_cmd_val = get_smb1_cmd_val, .get_cmd_val = get_smb1_cmd_val,
.init_rsp_hdr = init_smb1_rsp_hdr, .init_rsp_hdr = init_smb1_rsp_hdr,
.allocate_rsp_buf = smb1_allocate_rsp_buf, .allocate_rsp_buf = smb1_allocate_rsp_buf,
.check_user_session = smb1_check_user_session, .check_user_session = smb1_check_user_session,
.set_rsp_status = set_smb1_rsp_status,
}; };
static int smb1_negotiate(struct ksmbd_work *work) static int smb1_negotiate(struct ksmbd_work *work)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment