All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Lksctp-developers] [PATCH 2/3] sctp: fix integer overflow when
@ 2009-11-12 16:29 Vlad Yasevich
  2009-11-12 16:49 ` [Lksctp-developers] [PATCH 2/3] sctp: fix integer overflow when setting the autoclose timer Andrei Pelinescu-Onciul
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Vlad Yasevich @ 2009-11-12 16:29 UTC (permalink / raw)
  To: linux-sctp



Andrei Pelinescu-Onciul wrote:
> When setting the autoclose timeout in jiffies there is a possible
> integer overflow if the value in seconds is very large
> (e.g. for 2^22 s with HZ\x1024). The problem appears even on
> 64-bit due to the integer promotion rules. The fix is just a cast
>  to unsigned long.
> 
> Signed-off-by: Andrei Pelinescu-Onciul <andrei@iptel.org>
> ---
>  net/sctp/associola.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index 525864b..7f69f4d 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -166,7 +166,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
>  	asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0;
>  	asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay;
>  	asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] > -		sp->autoclose * HZ;
> +		(unsigned long)sp->autoclose * HZ;
>  
>  	/* Initilizes the timers */
>  	for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)

This becomes unnecessary with Patch 3.


-vlad

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-12 17:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-12 16:29 [Lksctp-developers] [PATCH 2/3] sctp: fix integer overflow when Vlad Yasevich
2009-11-12 16:49 ` [Lksctp-developers] [PATCH 2/3] sctp: fix integer overflow when setting the autoclose timer Andrei Pelinescu-Onciul
2009-11-12 17:05 ` [Lksctp-developers] [PATCH 2/3] sctp: fix integer overflow when Vlad Yasevich
2009-11-12 17:16 ` [Lksctp-developers] [PATCH 2/3] sctp: fix integer overflow when setting the autoclose timer Andrei Pelinescu-Onciul
2009-11-12 17:34 ` [Lksctp-developers] [PATCH 2/3] sctp: fix integer overflow when Vlad Yasevich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.