Skip to content

Commit 5a5409d

Browse files
namjaejeonsmfrench
authored andcommitted
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: [email protected] Reported-by: Robert Morris <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent f604971 commit 5a5409d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/smb/server/smb_common.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,22 @@ static int smb1_allocate_rsp_buf(struct ksmbd_work *work)
366366
return 0;
367367
}
368368

369+
/**
370+
* set_smb1_rsp_status() - set error type in smb response header
371+
* @work: smb work containing smb response header
372+
* @err: error code to set in response
373+
*/
374+
static void set_smb1_rsp_status(struct ksmbd_work *work, __le32 err)
375+
{
376+
work->send_no_response = 1;
377+
}
378+
369379
static struct smb_version_ops smb1_server_ops = {
370380
.get_cmd_val = get_smb1_cmd_val,
371381
.init_rsp_hdr = init_smb1_rsp_hdr,
372382
.allocate_rsp_buf = smb1_allocate_rsp_buf,
373383
.check_user_session = smb1_check_user_session,
384+
.set_rsp_status = set_smb1_rsp_status,
374385
};
375386

376387
static int smb1_negotiate(struct ksmbd_work *work)

0 commit comments

Comments
 (0)