lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKYAXd_ORc86pHr66OVhCAXWbvPy7Y2DVAH_ubipOXufQGD4dQ@mail.gmail.com>
Date: Wed, 5 Nov 2025 14:14:55 +0900
From: Namjae Jeon <linkinjeon@...nel.org>
To: Qianchang Zhao <pioooooooooip@...il.com>
Cc: Steve French <smfrench@...il.com>, Sergey Senozhatsky <senozhatsky@...omium.org>, 
	Tom Talpey <tom@...pey.com>, linux-cifs@...r.kernel.org, linux-kernel@...r.kernel.org, 
	gregkh@...uxfoundation.org, Zhitong Liu <liuzhitong1993@...il.com>, 
	stable@...r.kernel.org
Subject: Re: [PATCH] ksmbd: fix leak of transform buffer on encrypt_resp() failure

On Tue, Nov 4, 2025 at 11:12 PM Qianchang Zhao <pioooooooooip@...il.com> wrote:
>
> When encrypt_resp() fails at the send path, we only set
> STATUS_DATA_ERROR but leave the transform buffer allocated (work->tr_buf
> in this tree). Repeating this path leaks kernel memory and can lead to
> OOM (DoS) when encryption is required.
>
> Reproduced on: Linux v6.18-rc2 (self-built test kernel)
>
> Fix by freeing the transform buffer and forcing plaintext error reply.
>
> Reported-by: Qianchang Zhao <pioooooooooip@...il.com>
> Reported-by: Zhitong Liu <liuzhitong1993@...il.com>
> Cc: stable@...r.kernel.org
> Signed-off-by: Qianchang Zhao <pioooooooooip@...il.com>
> ---
>  fs/smb/server/server.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/smb/server/server.c b/fs/smb/server/server.c
> index 40420544c..15dd13e76 100644
> --- a/fs/smb/server/server.c
> +++ b/fs/smb/server/server.c
> @@ -244,8 +244,14 @@ static void __handle_ksmbd_work(struct ksmbd_work *work,
>         if (work->sess && work->sess->enc && work->encrypted &&
>             conn->ops->encrypt_resp) {
>                 rc = conn->ops->encrypt_resp(work);
> -               if (rc < 0)
> +               if (rc < 0) {
>                         conn->ops->set_rsp_status(work, STATUS_DATA_ERROR);
> +                       work->encrypted = false;
> +                       if (work->tr_buf) {
> +                               kvfree(work->tr_buf);
->tr_buf is freed in ksmbd_free_work_struct(). How can tr_buf not be freed?
Thanks.
> +                               work->tr_buf = NULL;
> +                       }
> +               }
>         }
>         if (work->sess)
>                 ksmbd_user_session_put(work->sess);
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ