Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/sctp: Prevent autoclose integer overflow in sctp_association_init()

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@vger.kernel.org
Fixes: 9f70f46bd4c7 ("sctp: properly latch and use autoclose value from sock to association")
Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20241219162114.2863827-1-kniv@yandex-team.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Nikolay Kuratov and committed by
Jakub Kicinski
4e86729d a4fd163a

+2 -1
+2 -1
net/sctp/associola.c
··· 137 137 = 5 * asoc->rto_max; 138 138 139 139 asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; 140 - asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ; 140 + asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = 141 + (unsigned long)sp->autoclose * HZ; 141 142 142 143 /* Initializes the timers */ 143 144 for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)