diff options
author | Florian Westphal <fw@strlen.de> | 2022-04-08 21:45:58 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-04-11 12:55:53 +0200 |
commit | 6b9ea5c81ea2bed80dc98a38d475124a87e7ab5d (patch) | |
tree | 2b38b2589e663a5e007721e694b3496cbd91d882 | |
parent | mptcp: add pm_nl_pernet helpers (diff) | |
download | linux-6b9ea5c81ea2bed80dc98a38d475124a87e7ab5d.tar.xz linux-6b9ea5c81ea2bed80dc98a38d475124a87e7ab5d.zip |
mptcp: diag: switch to context structure
Raw access to cb->arg[] is deprecated, use a context structure.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/mptcp/mptcp_diag.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/net/mptcp/mptcp_diag.c b/net/mptcp/mptcp_diag.c index f44125dd6697..c4992eeb67d8 100644 --- a/net/mptcp/mptcp_diag.c +++ b/net/mptcp/mptcp_diag.c @@ -66,20 +66,28 @@ out_nosk: return err; } +struct mptcp_diag_ctx { + long s_slot; + long s_num; +}; + static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, const struct inet_diag_req_v2 *r) { bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); + struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; struct net *net = sock_net(skb->sk); struct inet_diag_dump_data *cb_data; struct mptcp_sock *msk; struct nlattr *bc; + BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); + cb_data = cb->data; bc = cb_data->inet_diag_nla_bc; - while ((msk = mptcp_token_iter_next(net, &cb->args[0], &cb->args[1])) != - NULL) { + while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, + &diag_ctx->s_num)) != NULL) { struct inet_sock *inet = (struct inet_sock *)msk; struct sock *sk = (struct sock *)msk; int ret = 0; @@ -101,7 +109,7 @@ next: sock_put(sk); if (ret < 0) { /* will retry on the same position */ - cb->args[1]--; + diag_ctx->s_num--; break; } cond_resched(); |