mptcp: ensure the kernel PM does not take action too late

The PM hooks can currently take place when the msk is already shutting
down. Subflow creation will fail, thanks to the existing check at join
time, but we can entirely avoid starting the to be failed operations.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Geliang Tang <geliang@kernel.org>
Tested-by: Geliang Tang <geliang@kernel.org>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20251121-net-next-mptcp-memcg-backlog-imp-v1-7-1f34b6c1e0b1@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Paolo Abeni 2025-11-21 18:02:06 +01:00 committed by Jakub Kicinski
parent 2834f8edd7
commit 2ca1b8926f
2 changed files with 5 additions and 1 deletions

View File

@ -594,6 +594,7 @@ void mptcp_pm_subflow_established(struct mptcp_sock *msk)
void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
const struct mptcp_subflow_context *subflow) const struct mptcp_subflow_context *subflow)
{ {
struct sock *sk = (struct sock *)msk;
struct mptcp_pm_data *pm = &msk->pm; struct mptcp_pm_data *pm = &msk->pm;
bool update_subflows; bool update_subflows;
@ -617,7 +618,8 @@ void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
/* Even if this subflow is not really established, tell the PM to try /* Even if this subflow is not really established, tell the PM to try
* to pick the next ones, if possible. * to pick the next ones, if possible.
*/ */
if (mptcp_pm_nl_check_work_pending(msk)) if (mptcp_is_fully_established(sk) &&
mptcp_pm_nl_check_work_pending(msk))
mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED);
spin_unlock_bh(&pm->lock); spin_unlock_bh(&pm->lock);

View File

@ -337,6 +337,8 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
struct mptcp_pm_local local; struct mptcp_pm_local local;
mptcp_mpc_endpoint_setup(msk); mptcp_mpc_endpoint_setup(msk);
if (!mptcp_is_fully_established(sk))
return;
pr_debug("local %d:%d signal %d:%d subflows %d:%d\n", pr_debug("local %d:%d signal %d:%d subflows %d:%d\n",
msk->pm.local_addr_used, endp_subflow_max, msk->pm.local_addr_used, endp_subflow_max,