Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Paolo Abeni and committed by
Jakub Kicinski
2ca1b892 2834f8ed

+5 -1
+3 -1
net/mptcp/pm.c
··· 594 594 void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, 595 595 const struct mptcp_subflow_context *subflow) 596 596 { 597 + struct sock *sk = (struct sock *)msk; 597 598 struct mptcp_pm_data *pm = &msk->pm; 598 599 bool update_subflows; 599 600 ··· 618 617 /* Even if this subflow is not really established, tell the PM to try 619 618 * to pick the next ones, if possible. 620 619 */ 621 - if (mptcp_pm_nl_check_work_pending(msk)) 620 + if (mptcp_is_fully_established(sk) && 621 + mptcp_pm_nl_check_work_pending(msk)) 622 622 mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 623 623 624 624 spin_unlock_bh(&pm->lock);
+2
net/mptcp/pm_kernel.c
··· 337 337 struct mptcp_pm_local local; 338 338 339 339 mptcp_mpc_endpoint_setup(msk); 340 + if (!mptcp_is_fully_established(sk)) 341 + return; 340 342 341 343 pr_debug("local %d:%d signal %d:%d subflows %d:%d\n", 342 344 msk->pm.local_addr_used, endp_subflow_max,