Skip to content

Commit f916ec9

Browse files
nhormandavem330
authored andcommitted
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>
1 parent 2d4dda7 commit f916ec9

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

‎net/sctp/socket.c‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,8 +2579,10 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
25792579
return 0;
25802580
} else if (optlen == sizeof(struct sctp_assoc_value)) {
25812581
pr_warn_ratelimited(DEPRECATED
2582+
"%s (pid %d) "
25822583
"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));
25842586
if (copy_from_user(&params, optval, optlen))
25852587
return -EFAULT;
25862588

@@ -2996,8 +2998,10 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
29962998

29972999
if (optlen == sizeof(int)) {
29983000
pr_warn_ratelimited(DEPRECATED
3001+
"%s (pid %d) "
29993002
"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));
30013005
if (copy_from_user(&val, optval, optlen))
30023006
return -EFAULT;
30033007
params.assoc_id = 0;
@@ -3255,8 +3259,10 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
32553259

32563260
if (optlen == sizeof(int)) {
32573261
pr_warn_ratelimited(DEPRECATED
3262+
"%s (pid %d) "
32583263
"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));
32603266
if (copy_from_user(&val, optval, optlen))
32613267
return -EFAULT;
32623268
} else if (optlen == sizeof(struct sctp_assoc_value)) {
@@ -4577,8 +4583,10 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
45774583
return -EFAULT;
45784584
} else if (len == sizeof(struct sctp_assoc_value)) {
45794585
pr_warn_ratelimited(DEPRECATED
4586+
"%s (pid %d) "
45804587
"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));
45824590
if (copy_from_user(&params, optval, len))
45834591
return -EFAULT;
45844592
} else
@@ -5223,8 +5231,10 @@ static int sctp_getsockopt_maxseg(struct sock *sk, int len,
52235231

52245232
if (len == sizeof(int)) {
52255233
pr_warn_ratelimited(DEPRECATED
5234+
"%s (pid %d) "
52265235
"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));
52285238
params.assoc_id = 0;
52295239
} else if (len >= sizeof(struct sctp_assoc_value)) {
52305240
len = sizeof(struct sctp_assoc_value);
@@ -5316,8 +5326,10 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
53165326

53175327
if (len == sizeof(int)) {
53185328
pr_warn_ratelimited(DEPRECATED
5329+
"%s (pid %d) "
53195330
"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));
53215333
params.assoc_id = 0;
53225334
} else if (len >= sizeof(struct sctp_assoc_value)) {
53235335
len = sizeof(struct sctp_assoc_value);

0 commit comments

Comments
 (0)