aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2013-12-23 08:29:43 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-31 13:58:40 -0500
commit94f65193abbc07e4a4f3dbe3729ceb95c1493ea2 (patch)
tree0d2ece1a60e17bdcf6a39bc58e8412ddc0cc7d6a /net/sctp
parent0a9a8bfd29aa5ba2298dc80852cdbb63a42f6576 (diff)
SCTP: Reduce log spamming for sctp setsockopt
During a recent discussion regarding some sctp socket options, it was noted that we have several points at which we issue log warnings that can be flooded at an unbounded rate by any user. Fix this by converting all the pr_warns in the sctp_setsockopt path to be pr_warn_ratelimited. Note there are several debug level messages as well. I'm leaving those alone, as, if you turn on pr_debug, you likely want lots of verbosity. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Vlad Yasevich <vyasevich@gmail.com> CC: David Miller <davem@davemloft.net> CC: netdev@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/socket.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index adc5e3779b29..e9c5121e0fbf 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2578,8 +2578,9 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
2578 if (params.sack_delay == 0 && params.sack_freq == 0) 2578 if (params.sack_delay == 0 && params.sack_freq == 0)
2579 return 0; 2579 return 0;
2580 } else if (optlen == sizeof(struct sctp_assoc_value)) { 2580 } else if (optlen == sizeof(struct sctp_assoc_value)) {
2581 pr_warn("Use of struct sctp_assoc_value in delayed_ack socket option deprecated\n"); 2581 pr_warn_ratelimited(DEPRECATED
2582 pr_warn("Use struct sctp_sack_info instead\n"); 2582 "Use of struct sctp_assoc_value in delayed_ack socket option.\n"
2583 "Use struct sctp_sack_info instead\n");
2583 if (copy_from_user(&params, optval, optlen)) 2584 if (copy_from_user(&params, optval, optlen))
2584 return -EFAULT; 2585 return -EFAULT;
2585 2586
@@ -2994,8 +2995,9 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
2994 int val; 2995 int val;
2995 2996
2996 if (optlen == sizeof(int)) { 2997 if (optlen == sizeof(int)) {
2997 pr_warn("Use of int in maxseg socket option deprecated\n"); 2998 pr_warn_ratelimited(DEPRECATED
2998 pr_warn("Use struct sctp_assoc_value instead\n"); 2999 "Use of int in maxseg socket option.\n"
3000 "Use struct sctp_assoc_value instead\n");
2999 if (copy_from_user(&val, optval, optlen)) 3001 if (copy_from_user(&val, optval, optlen))
3000 return -EFAULT; 3002 return -EFAULT;
3001 params.assoc_id = 0; 3003 params.assoc_id = 0;
@@ -3252,8 +3254,9 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
3252 int assoc_id = 0; 3254 int assoc_id = 0;
3253 3255
3254 if (optlen == sizeof(int)) { 3256 if (optlen == sizeof(int)) {
3255 pr_warn("Use of int in max_burst socket option deprecated\n"); 3257 pr_warn_ratelimited(DEPRECATED
3256 pr_warn("Use struct sctp_assoc_value instead\n"); 3258 "Use of int in max_burst socket option deprecated.\n"
3259 "Use struct sctp_assoc_value instead\n");
3257 if (copy_from_user(&val, optval, optlen)) 3260 if (copy_from_user(&val, optval, optlen))
3258 return -EFAULT; 3261 return -EFAULT;
3259 } else if (optlen == sizeof(struct sctp_assoc_value)) { 3262 } else if (optlen == sizeof(struct sctp_assoc_value)) {
@@ -4573,8 +4576,9 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
4573 if (copy_from_user(&params, optval, len)) 4576 if (copy_from_user(&params, optval, len))
4574 return -EFAULT; 4577 return -EFAULT;
4575 } else if (len == sizeof(struct sctp_assoc_value)) { 4578 } else if (len == sizeof(struct sctp_assoc_value)) {
4576 pr_warn("Use of struct sctp_assoc_value in delayed_ack socket option deprecated\n"); 4579 pr_warn_ratelimited(DEPRECATED
4577 pr_warn("Use struct sctp_sack_info instead\n"); 4580 "Use of struct sctp_assoc_value in delayed_ack socket option.\n"
4581 "Use struct sctp_sack_info instead\n");
4578 if (copy_from_user(&params, optval, len)) 4582 if (copy_from_user(&params, optval, len))
4579 return -EFAULT; 4583 return -EFAULT;
4580 } else 4584 } else
@@ -5218,8 +5222,9 @@ static int sctp_getsockopt_maxseg(struct sock *sk, int len,
5218 struct sctp_association *asoc; 5222 struct sctp_association *asoc;
5219 5223
5220 if (len == sizeof(int)) { 5224 if (len == sizeof(int)) {
5221 pr_warn("Use of int in maxseg socket option deprecated\n"); 5225 pr_warn_ratelimited(DEPRECATED
5222 pr_warn("Use struct sctp_assoc_value instead\n"); 5226 "Use of int in maxseg socket option.\n"
5227 "Use struct sctp_assoc_value instead\n");
5223 params.assoc_id = 0; 5228 params.assoc_id = 0;
5224 } else if (len >= sizeof(struct sctp_assoc_value)) { 5229 } else if (len >= sizeof(struct sctp_assoc_value)) {
5225 len = sizeof(struct sctp_assoc_value); 5230 len = sizeof(struct sctp_assoc_value);
@@ -5310,8 +5315,9 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
5310 struct sctp_association *asoc; 5315 struct sctp_association *asoc;
5311 5316
5312 if (len == sizeof(int)) { 5317 if (len == sizeof(int)) {
5313 pr_warn("Use of int in max_burst socket option deprecated\n"); 5318 pr_warn_ratelimited(DEPRECATED
5314 pr_warn("Use struct sctp_assoc_value instead\n"); 5319 "Use of int in max_burst socket option.\n"
5320 "Use struct sctp_assoc_value instead\n");
5315 params.assoc_id = 0; 5321 params.assoc_id = 0;
5316 } else if (len >= sizeof(struct sctp_assoc_value)) { 5322 } else if (len >= sizeof(struct sctp_assoc_value)) {
5317 len = sizeof(struct sctp_assoc_value); 5323 len = sizeof(struct sctp_assoc_value);