]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mptcp: pm: kernel: correctly retransmit ADD_ADDR ID 0
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Mon, 18 May 2026 13:05:24 +0000 (09:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 May 2026 11:05:02 +0000 (13:05 +0200)
[ Upstream commit b12014d2d36eaed4e4bec5f1ac7e91110eeb100d ]

When adding the ADD_ADDR to the list, the address including the IP, port
and ID are copied. On the other hand, when the endpoint corresponds to
the one from the initial subflow, the ID is set to 0, as specified by
the MPTCP protocol.

The issue is that the ID was reset after having copied the ID in the
ADD_ADDR entry. So the retransmission was done, but using a different ID
than the initial one.

Fixes: 8b8ed1b429f8 ("mptcp: pm: reuse ID 0 after delete and re-add")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260505-net-mptcp-pm-fixes-7-1-rc3-v1-1-fca8091060a4@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ applied to net/mptcp/pm_netlink.c instead of upstream's pm_kernel.c ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mptcp/pm_netlink.c

index 085cf338ced194c556ef351f48c6001018311c8c..11743b37d01f67a914472f70e6bd5df6729b6e3a 100644 (file)
@@ -590,6 +590,8 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
        /* check first for announce */
        if (msk->pm.add_addr_signaled < add_addr_signal_max) {
+               u8 endp_id;
+
                /* due to racing events on both ends we can reach here while
                 * previous add address is still running: if we invoke now
                 * mptcp_pm_announce_addr(), that will fail and the
@@ -603,19 +605,20 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
                if (!select_signal_address(pernet, msk, &local))
                        goto subflow;
 
+               /* Special case for ID0: set the correct ID */
+               endp_id = local.addr.id;
+               if (endp_id == msk->mpc_endpoint_id)
+                       local.addr.id = 0;
+
                /* If the alloc fails, we are on memory pressure, not worth
                 * continuing, and trying to create subflows.
                 */
                if (!mptcp_pm_alloc_anno_list(msk, &local.addr))
                        return;
 
-               __clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
+               __clear_bit(endp_id, msk->pm.id_avail_bitmap);
                msk->pm.add_addr_signaled++;
 
-               /* Special case for ID0: set the correct ID */
-               if (local.addr.id == msk->mpc_endpoint_id)
-                       local.addr.id = 0;
-
                mptcp_pm_announce_addr(msk, &local.addr, false);
                mptcp_pm_nl_addr_send_ack(msk);