From: Ralph Boehme <slow@samba.org>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org, Tom Talpey <tom@talpey.com>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Steve French <smfrench@gmail.com>,
Hyunchul Lee <hyc.lee@gmail.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH v4 0/9] ksmbd: a bunch of patches that is being reviewed
Date: Fri, 1 Oct 2021 13:59:25 +0200 [thread overview]
Message-ID: <db055e2c-b5c5-8def-e2dd-066f84b29e36@samba.org> (raw)
In-Reply-To: <CAKYAXd8uU=4U1+_rXNeNtu1sAztshzXVi2SGVjcuSSmVtTc+8A@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1623 bytes --]
Am 01.10.21 um 03:10 schrieb Namjae Jeon:
> 1. You need to check header size of related pdu of compound request is
> already checked in the is_chained_smb2_message function.
>
> is_chained_smb2_message()
> ...
> if (next_cmd > 0) {
> if ((u64)work->next_smb2_rcv_hdr_off + next_cmd +
> __SMB2_HEADER_STRUCTURE_SIZE >
> get_rfc1002_len(work->request_buf)) {
> pr_err("next command(%u) offset exceeds smb msg size\n",
> next_cmd);
> return false;
> }
yeah, I already mentioned that in the commit message iirc. The problem
with this is that this logic is too brittle and hard to understand. The
code should be robust and easy to understand, that's why I strongly
suggest to add the check to ksmbd_smb2_check_message().
> 2. session id and tree id only needs to be checked in the header of
> the first pdu regardless of compound and single one.
Unless I'm completely off (which I sometimes are, so I'm prepared to be
proven false :) ), this is not correct. Cf MS-SMB2 3.3.5.2.7. For
non-related compound requests session-id and tree-id are to be taken
from each PDU.
Cf also the Samba code in smbd_smb2_request_dispatch() which calls
smbd_smb2_request_check_session() and smbd_smb2_request_check_tcon() to
implement the relevant logic.
I'll send what I have in a second.
-slow
--
Ralph Boehme, Samba Team https://samba.org/
SerNet Samba Team Lead https://sernet.de/en/team-samba
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
prev parent reply other threads:[~2021-10-01 11:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 8:44 [PATCH v4 0/9] ksmbd: a bunch of patches that is being reviewed Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 1/9] ksmbd: add the check to vaildate if stream protocol length exceeds maximum value Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 2/9] ksmbd: add validation in smb2_ioctl Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 3/9] ksmbd: use correct basic info level in set_file_basic_info() Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 4/9] ksmbd: add request buffer validation in smb2_set_info Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 5/9] ksmbd: check strictly data area in ksmbd_smb2_check_message() Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 6/9] ksmbd: add validation in smb2 negotiate Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 7/9] ksmbd: add buffer validation for SMB2_CREATE_CONTEXT Namjae Jeon
2021-09-29 8:45 ` [PATCH v4 8/9] ksmbd: remove the leftover of smb2.0 dialect support Namjae Jeon
2021-09-29 8:45 ` [PATCH v4 9/9] ksmbd: remove NTLMv1 authentication Namjae Jeon
2021-09-29 17:55 ` [PATCH v4 0/9] ksmbd: a bunch of patches that is being reviewed Ralph Boehme
2021-09-30 1:01 ` Namjae Jeon
2021-09-30 12:53 ` Ralph Boehme
2021-09-30 13:17 ` Namjae Jeon
2021-09-30 13:33 ` Ralph Boehme
2021-10-01 1:10 ` Namjae Jeon
2021-10-01 11:59 ` Ralph Boehme [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db055e2c-b5c5-8def-e2dd-066f84b29e36@samba.org \
--to=slow@samba.org \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=ronniesahlberg@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox