From: Andrei Pelinescu-Onciul Date: Mon, 23 Nov 2009 20:54:01 +0000 (-0500) Subject: sctp: limit maximum autoclose setsockopt value X-Git-Tag: v2.6.33-rc1~388^2~167^2~2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=f6778aab6ccc4b510b4dcfa770d9949b696b4545;p=~shefty%2Frdma-dev.git 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 --- diff --git a/net/sctp/socket.c b/net/sctp/socket.c index d2681a6bc6f..71513b3926a 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; }