sctp: fix incorrect overflow check on autoclose
Commit8ffd3208voids the previous patchesf6778aaband810c0719for limiting the autoclose value. If userspace passes in -1 on 32-bit platform, the overflow check didn't work and autoclose would be set to 0xffffffff. This patch defines a max_autoclose (in seconds) for limiting the value and exposes it through sysctl, with the following intentions. 1) Avoid overflowing autoclose * HZ. 2) Keep the default autoclose bound consistent across 32- and 64-bit platforms (INT_MAX / HZ in this patch). 3) Keep the autoclose value consistent between setsockopt() and getsockopt() calls. Suggested-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -1285,6 +1285,9 @@ SCTP_STATIC __init int sctp_init(void)
|
||||
sctp_max_instreams = SCTP_DEFAULT_INSTREAMS;
|
||||
sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS;
|
||||
|
||||
/* Initialize maximum autoclose timeout. */
|
||||
sctp_max_autoclose = INT_MAX / HZ;
|
||||
|
||||
/* Initialize handle used for association ids. */
|
||||
idr_init(&sctp_assocs_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user