summaryrefslogtreecommitdiff
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorXi Wang <xi.wang@gmail.com>2011-12-16 12:44:15 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-06 14:17:28 -0800
commit74631fca684d7a475f1eed5f6823c11b62bbd2bc (patch)
tree7f4581d47ce64338943371c10fd5b56712aa5a5b /net/sctp/socket.c
parent79a25778ca9fbc4ea2bd8c1f32d73bd73a1a3817 (diff)
sctp: fix incorrect overflow check on autoclose
[ Upstream commit 2692ba61a82203404abd7dd2a027bda962861f74 ] Commit 8ffd3208 voids the previous patches f6778aab and 810c0719 for 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 836aa63ee121..4760f4e65b80 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2199,8 +2199,6 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
return -EINVAL;
if (copy_from_user(&sp->autoclose, optval, optlen))
return -EFAULT;
- /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
- sp->autoclose = min_t(long, sp->autoclose, MAX_SCHEDULE_TIMEOUT / HZ);
return 0;
}