Skip to content

Commit

Permalink
ksmbd: handle malformed smb1 message
Browse files Browse the repository at this point in the history
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.

Reported-by: Robert Morris <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
namjaejeon committed Nov 9, 2023
1 parent 1bc2cbd commit 7dec4e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions smb_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,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)
Expand Down

0 comments on commit 7dec4e9

Please sign in to comment.