Skip to content

Commit f706e29

Browse files
matttbegregkh
authored andcommitted
mptcp: pm: don't try to create sf if alloc failed
commit cd7c957 upstream. It sounds better to avoid wasting cycles and / or put extreme memory pressure on the system by trying to create new subflows if it was not possible to add a new item in the announce list. While at it, a warning is now printed if the entry was already in the list as it should not happen with the in-kernel path-manager. With this PM, mptcp_pm_alloc_anno_list() should only fail in case of memory pressure. Fixes: b6c0838 ("mptcp: remove addr and subflow in PM netlink") Cc: stable@vger.kernel.org Suggested-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-4-c8a9b036493b@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a94f269 commit f706e29

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

net/mptcp/pm_netlink.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
348348
add_entry = mptcp_lookup_anno_list_by_saddr(msk, addr);
349349

350350
if (add_entry) {
351-
if (mptcp_pm_is_kernel(msk))
351+
if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk)))
352352
return false;
353353

354354
sk_reset_timer(sk, &add_entry->add_timer,
@@ -555,8 +555,6 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
555555

556556
/* check first for announce */
557557
if (msk->pm.add_addr_signaled < add_addr_signal_max) {
558-
local = select_signal_address(pernet, msk);
559-
560558
/* due to racing events on both ends we can reach here while
561559
* previous add address is still running: if we invoke now
562560
* mptcp_pm_announce_addr(), that will fail and the
@@ -567,11 +565,15 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
567565
if (msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_SIGNAL))
568566
return;
569567

568+
local = select_signal_address(pernet, msk);
570569
if (!local)
571570
goto subflow;
572571

572+
/* If the alloc fails, we are on memory pressure, not worth
573+
* continuing, and trying to create subflows.
574+
*/
573575
if (!mptcp_pm_alloc_anno_list(msk, &local->addr))
574-
goto subflow;
576+
return;
575577

576578
__clear_bit(local->addr.id, msk->pm.id_avail_bitmap);
577579
msk->pm.add_addr_signaled++;

0 commit comments

Comments
 (0)