[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A3FC3A11-C149-4527-84A2-541E951B7A86@nutanix.com>
Date: Tue, 12 Oct 2021 00:17:08 +0000
From: Eiichi Tsukata <eiichi.tsukata@...anix.com>
To: Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
CC: Greg KH <gregkh@...uxfoundation.org>,
Vlad Yasevich <vyasevich@...il.com>,
Neil Horman <nhorman@...driver.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
"linux-sctp@...r.kernel.org" <linux-sctp@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] sctp: account stream padding length for reconf chunk
Hi Marcelo
> On Oct 11, 2021, at 22:15, Marcelo Ricardo Leitner <marcelo.leitner@...il.com> wrote:
>
>
...
>
> So if stream_num was originally 1, stream_len would be 2, and with
> padding, 4. Here, nums would be 2 then, and not 1. The padding gets
> accounted as if it was payload.
>
> IOW, the patch is making the padding part of the parameter data by
> adding it to the header as well. SCTP padding works by having it in
> between them, and not inside them.
>
> This other approach avoids this issue by adding the padding only when
> allocating the packet. It (ab)uses the fact that inreq and outreq are
> already aligned to 4 bytes. Eiichi, can you please give it a go?
>
>
Thanks, I understood. I’ve tested your diff with my reproducer and it certainly works.
Your diff looks good to me.
>
> ---8<---
>
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index b8fa8f1a7277..c7503fd64915 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -3697,7 +3697,7 @@ struct sctp_chunk *sctp_make_strreset_req(
> outlen = (sizeof(outreq) + stream_len) * out;
> inlen = (sizeof(inreq) + stream_len) * in;
>
> - retval = sctp_make_reconf(asoc, outlen + inlen);
> + retval = sctp_make_reconf(asoc, SCTP_PAD4(outlen) + SCTP_PAD4(inlen));
> if (!retval)
> return NULL;
Regards,
Eiichi
Powered by blists - more mailing lists