Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da85b739 authored by Andrei Pelinescu-Onciul's avatar Andrei Pelinescu-Onciul Committed by Vlad Yasevich
Browse files

sctp: fix integer overflow when setting the autoclose timer



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: default avatarAndrei Pelinescu-Onciul <andrei@iptel.org>
Signed-off-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
parent f6778aab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)