mptcp: subflows garbage collection
The msk can close MP_JOIN subflows if the initial handshake
fails. Currently such subflows are kept alive in the
conn_list until the msk itself is closed.
Beyond the wasted memory, we could end-up sending the
DATA_FIN and the DATA_FIN ack on such socket, even after a
reset.
Fixes: 43b54c6ee3
("mptcp: Use full MPTCP-level disconnect state machine")
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:

committed by
Jakub Kicinski

parent
d582484726
commit
0e4f35d788
@@ -1383,6 +1383,20 @@ static void pm_work(struct mptcp_sock *msk)
|
||||
spin_unlock_bh(&msk->pm.lock);
|
||||
}
|
||||
|
||||
static void __mptcp_close_subflow(struct mptcp_sock *msk)
|
||||
{
|
||||
struct mptcp_subflow_context *subflow, *tmp;
|
||||
|
||||
list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
|
||||
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
|
||||
|
||||
if (inet_sk_state_load(ssk) != TCP_CLOSE)
|
||||
continue;
|
||||
|
||||
__mptcp_close_ssk((struct sock *)msk, ssk, subflow, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void mptcp_worker(struct work_struct *work)
|
||||
{
|
||||
struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work);
|
||||
@@ -1400,6 +1414,9 @@ static void mptcp_worker(struct work_struct *work)
|
||||
mptcp_clean_una(sk);
|
||||
mptcp_check_data_fin_ack(sk);
|
||||
__mptcp_flush_join_list(msk);
|
||||
if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags))
|
||||
__mptcp_close_subflow(msk);
|
||||
|
||||
__mptcp_move_skbs(msk);
|
||||
|
||||
if (msk->pm.status)
|
||||
|
Reference in New Issue
Block a user