From: David Laight <david.laight.linux@gmail.com>
To: Nikolay Kuratov <kniv@yandex-team.ru>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-sctp@vger.kernel.org,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Xin Long <lucien.xin@gmail.com>, Xi Wang <xi.wang@gmail.com>,
Neil Horman <nhorman@tuxdriver.com>,
Vlad Yasevich <vyasevich@gmail.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] net/sctp: Prevent autoclose integer overflow in sctp_association_init()
Date: Sat, 28 Dec 2024 12:10:18 +0000 [thread overview]
Message-ID: <20241228121018.6b4b78dc@dsl-u17-10> (raw)
In-Reply-To: <20241219162114.2863827-1-kniv@yandex-team.ru>
On Thu, 19 Dec 2024 19:21:14 +0300
Nikolay Kuratov <kniv@yandex-team.ru> wrote:
> While by default max_autoclose equals to INT_MAX / HZ, one may set
> net.sctp.max_autoclose to UINT_MAX. There is code in
> sctp_association_init() that can consequently trigger overflow.
>
> Cc: stable@vger.kernel.org
> Fixes: 9f70f46bd4c7 ("sctp: properly latch and use autoclose value from sock to association")
> Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
> ---
> net/sctp/associola.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index c45c192b7878..0b0794f164cf 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -137,7 +137,8 @@ static struct sctp_association *sctp_association_init(
> = 5 * asoc->rto_max;
>
> asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay;
> - asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ;
> + asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
> + (unsigned long)sp->autoclose * HZ;
That doesn't fix 32bit systems.
Looking through sctp/structs.h there are a lot of 'long' used for
timeouts.
it can't be right that any of these change size between 32bit and 64bit.
So they should either be __u32 or __u64 (or similar).
David
>
> /* Initializes the timers */
> for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)
next prev parent reply other threads:[~2024-12-28 12:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 16:21 [PATCH] net/sctp: Prevent autoclose integer overflow in sctp_association_init() Nikolay Kuratov
2024-12-23 15:27 ` Xin Long
2024-12-23 18:20 ` patchwork-bot+netdevbpf
2024-12-28 12:10 ` David Laight [this message]
2025-02-02 20:47 ` Fedor Pchelkin
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=20241228121018.6b4b78dc@dsl-u17-10 \
--to=david.laight.linux@gmail.com \
--cc=kniv@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=stable@vger.kernel.org \
--cc=vyasevich@gmail.com \
--cc=xi.wang@gmail.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