OSDN Git Service

mptcp: consolidate passive msk socket initialization
authorPaolo Abeni <pabeni@redhat.com>
Wed, 31 May 2023 19:37:05 +0000 (12:37 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Jun 2023 17:04:04 +0000 (10:04 -0700)
commit7e8b88ec35eef363040e08d99536d2bebef83774
treefb76f49f855a18fe073897b615eaddc3fec742ae
parent5b825727d0871b23e8867f6371183e61628b4a26
mptcp: consolidate passive msk socket initialization

When the msk socket is cloned at MPC handshake time, a few
fields are initialized in a racy way outside mptcp_sk_clone()
and the msk socket lock.

The above is due historical reasons: before commit a88d0092b24b
("mptcp: simplify subflow_syn_recv_sock()") as the first subflow socket
carrying all the needed date was not available yet at msk creation
time

We can now refactor the code moving the missing initialization bit
under the socket lock, removing the init race and avoiding some
code duplication.

This will also simplify the next patch, as all msk->first write
access are now under the msk socket lock.

Fixes: 0397c6d85f9c ("mptcp: keep unaccepted MPC subflow into join list")
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/protocol.c
net/mptcp/protocol.h
net/mptcp/subflow.c