From: Andrei Pelinescu-Onciul <andrei@iptel.org>
To: linux-sctp@vger.kernel.org
Subject: [PATCH 3/3] sctp: limit maximum autoclose setsockopt value
Date: Thu, 12 Nov 2009 15:52:16 +0000 [thread overview]
Message-ID: <20091112155216.GP10897@shell.iptel.org> (raw)
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>
---
net/sctp/socket.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 971890d..2f55723 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2072,6 +2072,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;
}
--
1.6.5.2
reply other threads:[~2009-11-12 15:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091112155216.GP10897@shell.iptel.org \
--to=andrei@iptel.org \
--cc=linux-sctp@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).