Re: [PATCH v7 3/9] ksmbd: add and use ksmbd_smb2_cur_pdu_buflen() in ksmbd_smb2_check_message()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2021-10-05 14:03 GMT+09:00, Ralph Boehme <slow@xxxxxxxxx>:
> No change in behaviour.
>
> Cc: Namjae Jeon <linkinjeon@xxxxxxxxxx>
> Cc: Tom Talpey <tom@xxxxxxxxxx>
> Cc: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
> Cc: Steve French <smfrench@xxxxxxxxx>
> Cc: Hyunchul Lee <hyc.lee@xxxxxxxxx>
> Signed-off-by: Ralph Boehme <slow@xxxxxxxxx>
> ---
>  fs/ksmbd/smb2misc.c | 36 +++++++++++++++++++++++++++---------
>  fs/ksmbd/smb2pdu.h  |  1 +
>  2 files changed, 28 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ksmbd/smb2misc.c b/fs/ksmbd/smb2misc.c
> index 2cc031c39514..7ed266eb6c5e 100644
> --- a/fs/ksmbd/smb2misc.c
> +++ b/fs/ksmbd/smb2misc.c
> @@ -333,14 +333,7 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
>  	struct smb2_hdr *hdr = &pdu->hdr;
>  	int command;
>  	__u32 clc_len;  /* calculated length */
> -	__u32 len = get_rfc1002_len(pdu);
> -
> -	if (le32_to_cpu(hdr->NextCommand) > 0) {
> -		len = le32_to_cpu(hdr->NextCommand);
> -	} else if (work->next_smb2_rcv_hdr_off) {
> -		len -= work->next_smb2_rcv_hdr_off;
> -		len = round_up(len, 8);
> -	}
> +	__u32 len = ksmbd_smb2_cur_pdu_buflen(work);
>
>  	if (check_smb2_hdr(hdr))
>  		return 1;
> @@ -395,7 +388,7 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
>  		 * Some windows servers (win2016) will pad also the final
>  		 * PDU in a compound to 8 bytes.
>  		 */
> -		if (ALIGN(clc_len, 8) == len)
> +		if (ALIGN(clc_len, 8) == ALIGN(len, 8))
Can I know why you align rfc1002 len with 8 here ?

Thanks!



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux