Skip to content

Commit 0e8c9e7

Browse files
author
Xin Long
committed
net/sctp: Prevent autoclose integer overflow in sctp_association_init()
JIRA: https://issues.redhat.com/browse/RHEL-73625 Tested: compile only commit 4e86729 Author: Nikolay Kuratov <kniv@yandex-team.ru> Date: Thu Dec 19 19:21:14 2024 +0300 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: 9f70f46 ("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> Signed-off-by: Xin Long <lxin@redhat.com>
1 parent 554f5bb commit 0e8c9e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sctp/associola.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ static struct sctp_association *sctp_association_init(
137137
= 5 * asoc->rto_max;
138138

139139
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;
141142

142143
/* Initializes the timers */
143144
for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)

0 commit comments

Comments
 (0)