Skip to content

Commit

Permalink
ksmbd: don't need 8byte alignment for request length in ksmbd_check_m…
Browse files Browse the repository at this point in the history
…essage

When validating request length in ksmbd_check_message, 8byte alignment
is not needed for compound request. It can cause wrong validation
of request length.

Fixes: e2f3448 ("cifsd: add server-side procedures for SMB3")
Cc: [email protected] # v5.15
Acked-by: Hyunchul Lee <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
namjaejeon authored and Steve French committed Nov 7, 2021
1 parent 78f1688 commit b53ad81
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/ksmbd/smb2misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,10 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
__u32 clc_len; /* calculated length */
__u32 len = get_rfc1002_len(pdu);

if (le32_to_cpu(hdr->NextCommand) > 0) {
if (le32_to_cpu(hdr->NextCommand) > 0)
len = le32_to_cpu(hdr->NextCommand);
} else if (work->next_smb2_rcv_hdr_off) {
else if (work->next_smb2_rcv_hdr_off)
len -= work->next_smb2_rcv_hdr_off;
len = round_up(len, 8);
}

if (check_smb2_hdr(hdr))
return 1;
Expand Down

0 comments on commit b53ad81

Please sign in to comment.