From: Paolo Abeni <pabeni@redhat.com>
To: menglong8.dong@gmail.com, mathew.j.martineau@linux.intel.com,
matthieu.baerts@tessares.net
Cc: mptcp@lists.linux.dev, Menglong Dong <imagedong@tencent.com>
Subject: Re: [PATCH mptcp-next v8 2/4] mptcp: add statistics for mptcp socket in use
Date: Mon, 12 Dec 2022 18:03:14 +0100 [thread overview]
Message-ID: <2fd384f250890912c039a23b2992b02fd4e313b3.camel@redhat.com> (raw)
In-Reply-To: <20221208024543.113633-3-imagedong@tencent.com>
On Thu, 2022-12-08 at 10:45 +0800, menglong8.dong@gmail.com wrote:
> diff --git a/net/mptcp/token.c b/net/mptcp/token.c
> index 65430f314a68..54064146175f 100644
> --- a/net/mptcp/token.c
> +++ b/net/mptcp/token.c
> @@ -175,6 +175,9 @@ int mptcp_token_new_connect(struct sock *sk)
> __sk_nulls_add_node_rcu((struct sock *)msk, &bucket->msk_chain);
> bucket->chain_len++;
> spin_unlock_bh(&bucket->lock);
> + sock_prot_inuse_add(sock_net(subflow->conn),
> + subflow->conn->sk_prot,
> + 1);
Whoops, sorry for not noticing the above earlier...
Here it would be better rename the mptcp_token_new_connect argument to
'ssk', and add a new local variable:
struct sock *sk = subflow->conn;
and replace the '(struct sock *)msk', 'subflow->conn' above with 'sk'.
Side note: the kunit crash is due to build_icsk() being too naive: it
creates a completely zeroed inet_connection_sock, while after this
patch mptcp_token_new_connect() requires that the sk_prot field is
initialized, too.
The issue could be addresses with an addtional chunk in token_test.c.
Note that for token's test sake, sk_prot could be initialized to any
available/already exported proto.
---
diff --git a/net/mptcp/token_test.c b/net/mptcp/token_test.c
index 5d984bec1cd8..3bffe8d0d36f 100644
--- a/net/mptcp/token_test.c
+++ b/net/mptcp/token_test.c
@@ -36,6 +36,9 @@ static struct inet_connection_sock *build_icsk(struct kunit *test)
icsk = kunit_kzalloc(test, sizeof(struct inet_connection_sock),
GFP_USER);
KUNIT_EXPECT_NOT_ERR_OR_NULL(test, icsk);
+
+ /* be sure the tocken helpers can dereference sk->sk_prot */
+ icsk->icsk_inet.sk.sk_prot = &tcp_prot;
return icsk;
}
next prev parent reply other threads:[~2022-12-12 17:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 2:45 [PATCH mptcp-next v8 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
2022-12-08 2:45 ` [PATCH mptcp-next v8 1/4] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen() menglong8.dong
2022-12-08 2:45 ` [PATCH mptcp-next v8 2/4] mptcp: add statistics for mptcp socket in use menglong8.dong
2022-12-08 13:53 ` Matthieu Baerts
2022-12-09 2:08 ` Menglong Dong
2022-12-12 16:35 ` Paolo Abeni
2022-12-16 8:01 ` Menglong Dong
2022-12-16 8:45 ` Paolo Abeni
2022-12-16 15:23 ` Menglong Dong
2022-12-12 17:03 ` Paolo Abeni [this message]
2022-12-16 8:04 ` Menglong Dong
2022-12-08 2:45 ` [PATCH mptcp-next v8 3/4] selftest: mptcp: exit from copyfd_io_poll() when receive SIGUSR1 menglong8.dong
2022-12-08 2:45 ` [PATCH mptcp-next v8 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-12-08 4:51 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2fd384f250890912c039a23b2992b02fd4e313b3.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=imagedong@tencent.com \
--cc=mathew.j.martineau@linux.intel.com \
--cc=matthieu.baerts@tessares.net \
--cc=menglong8.dong@gmail.com \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox