mptcp: pm: fix ID 0 endp usage after multiple re-creations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>

commit 9366922adc6a71378ca01f898c41be295309f044 upstream.

'local_addr_used' and 'add_addr_accepted' are decremented for addresses
not related to the initial subflow (ID0), because the source and
destination addresses of the initial subflows are known from the
beginning: they don't count as "additional local address being used" or
"ADD_ADDR being accepted".

It is then required not to increment them when the entrypoint used by
the initial subflow is removed and re-added during a connection. Without
this modification, this entrypoint cannot be removed and re-added more
than once.

Reported-by: Arınç ÜNAL <arinc.unal@xxxxxxxxxx>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/512
Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking")
Reported-by: syzbot+455d38ecd5f655fc45cf@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://lore.kernel.org/00000000000049861306209237f4@xxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx
Tested-by: Arınç ÜNAL <arinc.unal@xxxxxxxxxx>
Reviewed-by: Mat Martineau <martineau@xxxxxxxxxx>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 net/mptcp/pm_netlink.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -615,12 +615,13 @@ subflow:
 
 		fullmesh = !!(local.flags & MPTCP_PM_ADDR_FLAG_FULLMESH);
 
-		msk->pm.local_addr_used++;
 		__clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
 
 		/* Special case for ID0: set the correct ID */
 		if (local.addr.id == msk->mpc_endpoint_id)
 			local.addr.id = 0;
+		else /* local_addr_used is not decr for ID 0 */
+			msk->pm.local_addr_used++;
 
 		nr = fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs);
 		if (nr == 0)
@@ -750,7 +751,9 @@ static void mptcp_pm_nl_add_addr_receive
 	spin_lock_bh(&msk->pm.lock);
 
 	if (sf_created) {
-		msk->pm.add_addr_accepted++;
+		/* add_addr_accepted is not decr for ID 0 */
+		if (remote.id)
+			msk->pm.add_addr_accepted++;
 		if (msk->pm.add_addr_accepted >= add_addr_accept_max ||
 		    msk->pm.subflows >= subflows_max)
 			WRITE_ONCE(msk->pm.accept_addr, false);


Patches currently in stable-queue which might be from matttbe@xxxxxxxxxx are

queue-6.10/selftests-mptcp-join-cannot-rm-sf-if-closed.patch
queue-6.10/mptcp-pm-fix-rm_addr-id-for-the-initial-subflow.patch
queue-6.10/mptcp-pm-fix-id-0-endp-usage-after-multiple-re-creations.patch
queue-6.10/mptcp-pm-skip-connecting-to-already-established-sf.patch
queue-6.10/mptcp-pm-reuse-id-0-after-delete-and-re-add.patch
queue-6.10/mptcp-avoid-duplicated-sub_closed-events.patch
queue-6.10/mptcp-pm-add_addr-0-is-not-a-new-address.patch
queue-6.10/mptcp-pm-do-not-remove-already-closed-subflows.patch
queue-6.10/mptcp-pm-send-ack-on-an-active-subflow.patch
queue-6.10/mptcp-pm-reset-mpc-endp-id-when-re-added.patch
queue-6.10/mptcp-close-subflow-when-receiving-tcp-fin.patch
queue-6.10/selftests-mptcp-join-check-re-re-adding-id-0-endp.patch
queue-6.10/selftests-mptcp-join-no-extra-msg-if-no-counter.patch
queue-6.10/mptcp-pr_debug-add-missing-n-at-the-end.patch
queue-6.10/selftests-mptcp-join-check-removing-id-0-endpoint.patch
queue-6.10/mptcp-sched-check-both-backup-in-retrans.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux