Skip to contentSkip to conversation

sctp: fix integer overflow when setting the autoclose timer

PATCH New Andrei Pelinescu-Onciul 1 participant 1 message Nov 12, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 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 HZ24). The problem appears even on 64-bit due to the integer promotion rules. The fix is just a cast
to unsigned long.

---
 net/sctp/associola.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/sctp/associola.c +1 -0
index 525864b..7f69f4d 100644
@@ -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)
Signature · 1 line
1.6.5.2