diff options
author | Neil Horman <nhorman@tuxdriver.com> | 2014-01-02 12:54:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-03 19:36:46 -0500 |
commit | f916ec9608af017dda3e0fa7b5c6a344fc05285e (patch) | |
tree | 5de8cba646cb8878c23e5517115c49f01dd27d86 /net/sctp | |
parent | 2d4dda781fc1e9c929a1f699119b91eddbcf475c (diff) |
sctp: Add process name and pid to deprecation warnings
Recently I updated the sctp socket option deprecation warnings to be both a bit
more clear and ratelimited to prevent user processes from spamming the log file.
Ben Hutchings suggested that I add the process name and pid to these warnings so
that users can tell who is responsible for using the deprecated apis. This
patch accomplishes that.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Vlad Yasevich <vyasevich@gmail.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
CC: "David S. 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.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e9c5121e0fbf..d32dae78a486 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2579,8 +2579,10 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk, | |||
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_ratelimited(DEPRECATED | 2581 | pr_warn_ratelimited(DEPRECATED |
2582 | "%s (pid %d) " | ||
2582 | "Use of struct sctp_assoc_value in delayed_ack socket option.\n" | 2583 | "Use of struct sctp_assoc_value in delayed_ack socket option.\n" |
2583 | "Use struct sctp_sack_info instead\n"); | 2584 | "Use struct sctp_sack_info instead\n", |
2585 | current->comm, task_pid_nr(current)); | ||
2584 | if (copy_from_user(¶ms, optval, optlen)) | 2586 | if (copy_from_user(¶ms, optval, optlen)) |
2585 | return -EFAULT; | 2587 | return -EFAULT; |
2586 | 2588 | ||
@@ -2996,8 +2998,10 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned | |||
2996 | 2998 | ||
2997 | if (optlen == sizeof(int)) { | 2999 | if (optlen == sizeof(int)) { |
2998 | pr_warn_ratelimited(DEPRECATED | 3000 | pr_warn_ratelimited(DEPRECATED |
3001 | "%s (pid %d) " | ||
2999 | "Use of int in maxseg socket option.\n" | 3002 | "Use of int in maxseg socket option.\n" |
3000 | "Use struct sctp_assoc_value instead\n"); | 3003 | "Use struct sctp_assoc_value instead\n", |
3004 | current->comm, task_pid_nr(current)); | ||
3001 | if (copy_from_user(&val, optval, optlen)) | 3005 | if (copy_from_user(&val, optval, optlen)) |
3002 | return -EFAULT; | 3006 | return -EFAULT; |
3003 | params.assoc_id = 0; | 3007 | params.assoc_id = 0; |
@@ -3255,8 +3259,10 @@ static int sctp_setsockopt_maxburst(struct sock *sk, | |||
3255 | 3259 | ||
3256 | if (optlen == sizeof(int)) { | 3260 | if (optlen == sizeof(int)) { |
3257 | pr_warn_ratelimited(DEPRECATED | 3261 | pr_warn_ratelimited(DEPRECATED |
3262 | "%s (pid %d) " | ||
3258 | "Use of int in max_burst socket option deprecated.\n" | 3263 | "Use of int in max_burst socket option deprecated.\n" |
3259 | "Use struct sctp_assoc_value instead\n"); | 3264 | "Use struct sctp_assoc_value instead\n", |
3265 | current->comm, task_pid_nr(current)); | ||
3260 | if (copy_from_user(&val, optval, optlen)) | 3266 | if (copy_from_user(&val, optval, optlen)) |
3261 | return -EFAULT; | 3267 | return -EFAULT; |
3262 | } else if (optlen == sizeof(struct sctp_assoc_value)) { | 3268 | } else if (optlen == sizeof(struct sctp_assoc_value)) { |
@@ -4577,8 +4583,10 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, | |||
4577 | return -EFAULT; | 4583 | return -EFAULT; |
4578 | } else if (len == sizeof(struct sctp_assoc_value)) { | 4584 | } else if (len == sizeof(struct sctp_assoc_value)) { |
4579 | pr_warn_ratelimited(DEPRECATED | 4585 | pr_warn_ratelimited(DEPRECATED |
4586 | "%s (pid %d) " | ||
4580 | "Use of struct sctp_assoc_value in delayed_ack socket option.\n" | 4587 | "Use of struct sctp_assoc_value in delayed_ack socket option.\n" |
4581 | "Use struct sctp_sack_info instead\n"); | 4588 | "Use struct sctp_sack_info instead\n", |
4589 | current->comm, task_pid_nr(current)); | ||
4582 | if (copy_from_user(¶ms, optval, len)) | 4590 | if (copy_from_user(¶ms, optval, len)) |
4583 | return -EFAULT; | 4591 | return -EFAULT; |
4584 | } else | 4592 | } else |
@@ -5223,8 +5231,10 @@ static int sctp_getsockopt_maxseg(struct sock *sk, int len, | |||
5223 | 5231 | ||
5224 | if (len == sizeof(int)) { | 5232 | if (len == sizeof(int)) { |
5225 | pr_warn_ratelimited(DEPRECATED | 5233 | pr_warn_ratelimited(DEPRECATED |
5234 | "%s (pid %d) " | ||
5226 | "Use of int in maxseg socket option.\n" | 5235 | "Use of int in maxseg socket option.\n" |
5227 | "Use struct sctp_assoc_value instead\n"); | 5236 | "Use struct sctp_assoc_value instead\n", |
5237 | current->comm, task_pid_nr(current)); | ||
5228 | params.assoc_id = 0; | 5238 | params.assoc_id = 0; |
5229 | } else if (len >= sizeof(struct sctp_assoc_value)) { | 5239 | } else if (len >= sizeof(struct sctp_assoc_value)) { |
5230 | len = sizeof(struct sctp_assoc_value); | 5240 | len = sizeof(struct sctp_assoc_value); |
@@ -5316,8 +5326,10 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len, | |||
5316 | 5326 | ||
5317 | if (len == sizeof(int)) { | 5327 | if (len == sizeof(int)) { |
5318 | pr_warn_ratelimited(DEPRECATED | 5328 | pr_warn_ratelimited(DEPRECATED |
5329 | "%s (pid %d) " | ||
5319 | "Use of int in max_burst socket option.\n" | 5330 | "Use of int in max_burst socket option.\n" |
5320 | "Use struct sctp_assoc_value instead\n"); | 5331 | "Use struct sctp_assoc_value instead\n", |
5332 | current->comm, task_pid_nr(current)); | ||
5321 | params.assoc_id = 0; | 5333 | params.assoc_id = 0; |
5322 | } else if (len >= sizeof(struct sctp_assoc_value)) { | 5334 | } else if (len >= sizeof(struct sctp_assoc_value)) { |
5323 | len = sizeof(struct sctp_assoc_value); | 5335 | len = sizeof(struct sctp_assoc_value); |