Re: [PATCH v2 13/14] smb: server: use smb_decompress_alloc_size() in ksmbd_decompress_request()

Namjae Jeon <[email protected]> Sat, 25 Jul 2026 22:08:51 +0900
Newsgroups org.kernel.vger.linux-cifs
Message-ID <CAKYAXd_mkSR_=krs0idmhR_uYxUTzHAFK1cB7tZRtNfMJUSsRw@mail.gmail.com>
On Tue, Jul 21, 2026 at 4:50 AM Enzo Matsumiya <[email protected]> wrote:
>
> Use common helper to validate compress header and get decompressed size.
>
> Signed-off-by: Enzo Matsumiya <[email protected]>
I can not apply this patch to #ksmbd-for-next-next.
Can you create this patch based on #ksmbd-for-next-next ?

> -       max_allowed_pdu_size = SMB3_MAX_MSGSIZE + conn->vals->max_write_size;
> -       if (out_size > max_allowed_pdu_size ||
> -           out_size > MAX_STREAM_PROT_LEN)
> +       buf = smb_get_msg(conn->request_buf);
> +       out_size = smb_decompress_alloc_size(buf, pdu_size, 0,
> +                                            SMB3_MAX_MSGSIZE + conn->vals->max_write_size,
> +                                            conn->compress_chained);
In ksmbd_decompress_request(), the old code rejected decompressed
messages smaller than sizeof(struct smb2_pdu).  The new helper call
passes 0 as dmin.
So you need to pass sizeof(struct smb2_pdu) as dmin :
out_size = smb_decompress_alloc_size(buf, pdu_size,
                                           sizeof(struct smb2_pdu),
                                           SMB3_MAX_MSGSIZE +
                                           conn->vals->max_write_size,
                                           conn->compress_chained);

Except this, The other server and common patches look good to me. I'll
leave the client patches to the cifs.ko developers.

Thanks.