[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241228121018.6b4b78dc@dsl-u17-10>
Date: Sat, 28 Dec 2024 12:10:18 +0000
From: David Laight <david.laight.linux@...il.com>
To: Nikolay Kuratov <kniv@...dex-team.ru>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-sctp@...r.kernel.org, Marcelo Ricardo Leitner
<marcelo.leitner@...il.com>, Xin Long <lucien.xin@...il.com>, Xi Wang
<xi.wang@...il.com>, Neil Horman <nhorman@...driver.com>, Vlad Yasevich
<vyasevich@...il.com>, stable@...r.kernel.org
Subject: Re: [PATCH] net/sctp: Prevent autoclose integer overflow in
sctp_association_init()
On Thu, 19 Dec 2024 19:21:14 +0300
Nikolay Kuratov <kniv@...dex-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@...r.kernel.org
> Fixes: 9f70f46bd4c7 ("sctp: properly latch and use autoclose value from sock to association")
> Signed-off-by: Nikolay Kuratov <kniv@...dex-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)
Powered by blists - more mailing lists