From f6778aab6ccc4b510b4dcfa770d9949b696b4545 Mon Sep 17 00:00:00 2001 From: Andrei Pelinescu-Onciul Date: Mon, 23 Nov 2009 15:54:01 -0500 Subject: 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 Signed-off-by: Vlad Yasevich --- net/sctp/socket.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'net') 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; } -- cgit v1.2.3