[PATCH 5.10.y 2/2] mptcp: decrement subflows counter on failed passive join
Sasha Levin <[email protected]>
| Newsgroups | org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
From: Chenguang Zhao <[email protected]> [ Upstream commit f3ca0ee2cc308e33896536789cbc5f3a12ca7b30 ] mptcp_pm_allow_new_subflow() increments extra_subflows before __mptcp_finish_join() on the passive MP_JOIN path. In case of race conditions, the subflow is dropped without calling mptcp_close_ssk(), so the counter is not rolled back. Call mptcp_pm_close_subflow() when the join completion fails to decrement the subflows counter. Fixes: 10f6d46c943d ("mptcp: fix race between MP_JOIN and close") Cc: [email protected] Signed-off-by: Chenguang Zhao <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/20260722-net-mptcp-misc-fixes-7-2-rc5-v1-1-6fb595bc86ef@kernel.org Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]> --- net/mptcp/protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index a9595eb2b5fee..2c6aef813473f 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2663,8 +2663,10 @@ bool mptcp_finish_join(struct sock *sk) if (ret && !WARN_ON_ONCE(!list_empty(&subflow->node))) list_add_tail(&subflow->node, &msk->join_list); spin_unlock_bh(&msk->join_list_lock); - if (!ret) + if (!ret) { + mptcp_pm_close_subflow(msk); return false; + } /* attach to msk socket only after we are sure he will deal with us * at close time -- 2.53.0