Commit 89ba52bd authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp_logspam'

Neil Horman says:

====================
sctp: Consolidate and ratelimit deprecation warnings

The SCTP protocol has several deprecation warnings in its setsockopt path that
can be triggered by unprivlidged users.  Since these are not ratelimited, we can
spam the logs quite easily here.  Since these are all deprecation warnings, and
that type of warning isn't uncommon in the rest of the kernel, lets make a
common pr_warn_deprecated macro to produce somewhat generalized ratelimited
deprecation warnings easily
====================
Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c76f2a2c 94f65193
...@@ -87,6 +87,13 @@ struct va_format { ...@@ -87,6 +87,13 @@ struct va_format {
*/ */
#define HW_ERR "[Hardware Error]: " #define HW_ERR "[Hardware Error]: "
/*
* DEPRECATED
* Add this to a message whenever you want to warn user space about the use
* of a deprecated aspect of an API so they can stop using it
*/
#define DEPRECATED "[Deprecated]: "
/* /*
* Dummy printk for disabled debugging statements to use whilst maintaining * Dummy printk for disabled debugging statements to use whilst maintaining
* gcc's format and side-effect checking. * gcc's format and side-effect checking.
......
...@@ -2578,8 +2578,9 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk, ...@@ -2578,8 +2578,9 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
if (params.sack_delay == 0 && params.sack_freq == 0) if (params.sack_delay == 0 && params.sack_freq == 0)
return 0; return 0;
} else if (optlen == sizeof(struct sctp_assoc_value)) { } else if (optlen == sizeof(struct sctp_assoc_value)) {
pr_warn("Use of struct sctp_assoc_value in delayed_ack socket option deprecated\n"); pr_warn_ratelimited(DEPRECATED
pr_warn("Use struct sctp_sack_info instead\n"); "Use of struct sctp_assoc_value in delayed_ack socket option.\n"
"Use struct sctp_sack_info instead\n");
if (copy_from_user(&params, optval, optlen)) if (copy_from_user(&params, optval, optlen))
return -EFAULT; return -EFAULT;
...@@ -2994,8 +2995,9 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned ...@@ -2994,8 +2995,9 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
int val; int val;
if (optlen == sizeof(int)) { if (optlen == sizeof(int)) {
pr_warn("Use of int in maxseg socket option deprecated\n"); pr_warn_ratelimited(DEPRECATED
pr_warn("Use struct sctp_assoc_value instead\n"); "Use of int in maxseg socket option.\n"
"Use struct sctp_assoc_value instead\n");
if (copy_from_user(&val, optval, optlen)) if (copy_from_user(&val, optval, optlen))
return -EFAULT; return -EFAULT;
params.assoc_id = 0; params.assoc_id = 0;
...@@ -3252,8 +3254,9 @@ static int sctp_setsockopt_maxburst(struct sock *sk, ...@@ -3252,8 +3254,9 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
int assoc_id = 0; int assoc_id = 0;
if (optlen == sizeof(int)) { if (optlen == sizeof(int)) {
pr_warn("Use of int in max_burst socket option deprecated\n"); pr_warn_ratelimited(DEPRECATED
pr_warn("Use struct sctp_assoc_value instead\n"); "Use of int in max_burst socket option deprecated.\n"
"Use struct sctp_assoc_value instead\n");
if (copy_from_user(&val, optval, optlen)) if (copy_from_user(&val, optval, optlen))
return -EFAULT; return -EFAULT;
} else if (optlen == sizeof(struct sctp_assoc_value)) { } else if (optlen == sizeof(struct sctp_assoc_value)) {
...@@ -4573,8 +4576,9 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, ...@@ -4573,8 +4576,9 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
if (copy_from_user(&params, optval, len)) if (copy_from_user(&params, optval, len))
return -EFAULT; return -EFAULT;
} else if (len == sizeof(struct sctp_assoc_value)) { } else if (len == sizeof(struct sctp_assoc_value)) {
pr_warn("Use of struct sctp_assoc_value in delayed_ack socket option deprecated\n"); pr_warn_ratelimited(DEPRECATED
pr_warn("Use struct sctp_sack_info instead\n"); "Use of struct sctp_assoc_value in delayed_ack socket option.\n"
"Use struct sctp_sack_info instead\n");
if (copy_from_user(&params, optval, len)) if (copy_from_user(&params, optval, len))
return -EFAULT; return -EFAULT;
} else } else
...@@ -5218,8 +5222,9 @@ static int sctp_getsockopt_maxseg(struct sock *sk, int len, ...@@ -5218,8 +5222,9 @@ static int sctp_getsockopt_maxseg(struct sock *sk, int len,
struct sctp_association *asoc; struct sctp_association *asoc;
if (len == sizeof(int)) { if (len == sizeof(int)) {
pr_warn("Use of int in maxseg socket option deprecated\n"); pr_warn_ratelimited(DEPRECATED
pr_warn("Use struct sctp_assoc_value instead\n"); "Use of int in maxseg socket option.\n"
"Use struct sctp_assoc_value instead\n");
params.assoc_id = 0; params.assoc_id = 0;
} else if (len >= sizeof(struct sctp_assoc_value)) { } else if (len >= sizeof(struct sctp_assoc_value)) {
len = sizeof(struct sctp_assoc_value); len = sizeof(struct sctp_assoc_value);
...@@ -5310,8 +5315,9 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len, ...@@ -5310,8 +5315,9 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
struct sctp_association *asoc; struct sctp_association *asoc;
if (len == sizeof(int)) { if (len == sizeof(int)) {
pr_warn("Use of int in max_burst socket option deprecated\n"); pr_warn_ratelimited(DEPRECATED
pr_warn("Use struct sctp_assoc_value instead\n"); "Use of int in max_burst socket option.\n"
"Use struct sctp_assoc_value instead\n");
params.assoc_id = 0; params.assoc_id = 0;
} else if (len >= sizeof(struct sctp_assoc_value)) { } else if (len >= sizeof(struct sctp_assoc_value)) {
len = sizeof(struct sctp_assoc_value); len = sizeof(struct sctp_assoc_value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment