mptcp: keep unaccepted MPC subflow into join list
This will simplify all operation dealing with subflows before accept time (e.g. data fin processing, add_addr). The join list is already flushed by mptcp_stream_accept() before returning the newly created msk to the user space. This also fixes an potential bug present into the old code: conn_list was manipulated without helding the msk lock in mptcp_stream_accept(). Tested-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
8b819a84d4
commit
0397c6d85f
@@ -578,6 +578,10 @@ create_child:
|
||||
*/
|
||||
inet_sk_state_store((void *)new_msk, TCP_ESTABLISHED);
|
||||
|
||||
/* link the newly created socket to the msk */
|
||||
mptcp_add_pending_subflow(mptcp_sk(new_msk), ctx);
|
||||
WRITE_ONCE(mptcp_sk(new_msk)->first, child);
|
||||
|
||||
/* new mpc subflow takes ownership of the newly
|
||||
* created mptcp socket
|
||||
*/
|
||||
@@ -1124,11 +1128,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
|
||||
if (err && err != -EINPROGRESS)
|
||||
goto failed;
|
||||
|
||||
sock_hold(ssk);
|
||||
spin_lock_bh(&msk->join_list_lock);
|
||||
list_add_tail(&subflow->node, &msk->join_list);
|
||||
spin_unlock_bh(&msk->join_list_lock);
|
||||
|
||||
mptcp_add_pending_subflow(msk, subflow);
|
||||
return err;
|
||||
|
||||
failed:
|
||||
|
||||
Reference in New Issue
Block a user