]> Pileus Git - ~andy/linux/commitdiff
sctp: fix integer overflow when setting the autoclose timer
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Mon, 23 Nov 2009 20:54:01 +0000 (15:54 -0500)
committerVlad Yasevich <vladislav.yasevich@hp.com>
Mon, 23 Nov 2009 20:54:01 +0000 (15:54 -0500)
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=1024). 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>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
net/sctp/associola.c

index 880dae2ca87bf30f26d284eaf8871561c37d260b..6e96f83570c957df2e3804f26342d902b8f1ab5a 100644 (file)
@@ -167,7 +167,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)