summaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorAndrei Pelinescu-Onciul <andrei@iptel.org>2009-11-23 21:54:01 +0100
committerVlad Yasevich <vladislav.yasevich@hp.com>2009-11-23 21:54:01 +0100
commitf6778aab6ccc4b510b4dcfa770d9949b696b4545 (patch)
treed3aca83fb8994d2efbc5420d68e1d27f1c8c08a7 /net/sctp
parentsctp: Fix mis-ordering of user space data when multihoming in use (diff)
downloadlinux-f6778aab6ccc4b510b4dcfa770d9949b696b4545.tar.xz
linux-f6778aab6ccc4b510b4dcfa770d9949b696b4545.zip
sctp: limit maximum autoclose setsockopt value
To avoid overflowing the maximum timer interval when transforming the autoclose interval from seconds to jiffies, limit the maximum autoclose value to MAX_SCHEDULE_TIMEOUT/HZ. Signed-off-by: Andrei Pelinescu-Onciul <andrei@iptel.org> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d2681a6bc6fa..71513b3926a5 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2086,6 +2086,9 @@ 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 */
+ if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
+ sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
return 0;
}