public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: paul.gortmaker@windriver.com
Cc: Namjae Jeon <linkinjeon@kernel.org>,
	Steve French <stfrench@microsoft.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/1] ksmbd: check the validation of pdu_size in ksmbd_conn_handler_loop
Date: Mon, 18 Dec 2023 11:38:25 +0100	[thread overview]
Message-ID: <2023121813-compactor-lettuce-4ced@gregkh> (raw)
In-Reply-To: <20231212184745.2245187-2-paul.gortmaker@windriver.com>

On Tue, Dec 12, 2023 at 01:47:45PM -0500, paul.gortmaker@windriver.com wrote:
> From: Namjae Jeon <linkinjeon@kernel.org>
> 
> commit 368ba06881c395f1c9a7ba22203cf8d78b4addc0 upstream.
> 
> The length field of netbios header must be greater than the SMB header
> sizes(smb1 or smb2 header), otherwise the packet is an invalid SMB packet.
> 
> If `pdu_size` is 0, ksmbd allocates a 4 bytes chunk to `conn->request_buf`.
> In the function `get_smb2_cmd_val` ksmbd will read cmd from
> `rcv_hdr->Command`, which is `conn->request_buf + 12`, causing the KASAN
> detector to print the following error message:
> 
> [    7.205018] BUG: KASAN: slab-out-of-bounds in get_smb2_cmd_val+0x45/0x60
> [    7.205423] Read of size 2 at addr ffff8880062d8b50 by task ksmbd:42632/248
> ...
> [    7.207125]  <TASK>
> [    7.209191]  get_smb2_cmd_val+0x45/0x60
> [    7.209426]  ksmbd_conn_enqueue_request+0x3a/0x100
> [    7.209712]  ksmbd_server_process_request+0x72/0x160
> [    7.210295]  ksmbd_conn_handler_loop+0x30c/0x550
> [    7.212280]  kthread+0x160/0x190
> [    7.212762]  ret_from_fork+0x1f/0x30
> [    7.212981]  </TASK>
> 
> Cc: stable@vger.kernel.org
> Reported-by: Chih-Yen Chang <cc85nod@gmail.com>
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> [PG: fs/smb/server/connection.c --> fs/ksmbd/connection.c for v5.15.
>  Also no smb2_get_msg() as no +4 from cb4517201b8a in v5.15 baseline.]
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  fs/ksmbd/connection.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Now queued up, thanks.

greg k-h

  parent reply	other threads:[~2023-12-18 10:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 18:47 [PATCH 0/1] RFC: linux-5.15.y ksmbd backport for CVE-2023-38431 paul.gortmaker
2023-12-12 18:47 ` [PATCH 1/1] ksmbd: check the validation of pdu_size in ksmbd_conn_handler_loop paul.gortmaker
2023-12-13  4:59   ` Namjae Jeon
2023-12-18 10:38   ` Greg KH [this message]
2023-12-18 11:28     ` Namjae Jeon
2023-12-18 11:38       ` Greg KH
2023-12-12 20:04 ` [PATCH 0/1] RFC: linux-5.15.y ksmbd backport for CVE-2023-38431 Greg KH
2023-12-12 20:13   ` [EXTERNAL] " Steven French
2023-12-12 20:52     ` Paul Gortmaker
2023-12-12 21:15       ` Steven French
2023-12-13 14:36     ` Greg KH
2023-12-13 23:31       ` Namjae Jeon
2023-12-14  8:05         ` Greg KH
2023-12-14 11:33           ` Namjae Jeon
2023-12-14 11:58             ` Greg KH
2023-12-14 13:58               ` Namjae Jeon
2023-12-12 20:45   ` Paul Gortmaker
2023-12-13 14:34     ` Greg KH
2023-12-14  3:28       ` Paul Gortmaker
2023-12-14  8:20         ` Greg KH
2023-12-15  4:18           ` Paul Gortmaker
2023-12-13  5:13 ` Namjae Jeon

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=2023121813-compactor-lettuce-4ced@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linkinjeon@kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.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