mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
mptcp: pm: fix ID 0 endp usage after multiple re-creations
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@arinc9.com>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/512
Fixes: 3ad14f54bd
("mptcp: more accurate MPC endpoint tracking")
Reported-by: syzbot+455d38ecd5f655fc45cf@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/00000000000049861306209237f4@google.com
Cc: stable@vger.kernel.org
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
78b0414986
commit
53e2173172
1 changed files with 5 additions and 2 deletions
|
@ -623,12 +623,13 @@ subflow:
|
||||||
|
|
||||||
fullmesh = !!(local.flags & MPTCP_PM_ADDR_FLAG_FULLMESH);
|
fullmesh = !!(local.flags & MPTCP_PM_ADDR_FLAG_FULLMESH);
|
||||||
|
|
||||||
msk->pm.local_addr_used++;
|
|
||||||
__clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
|
__clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
|
||||||
|
|
||||||
/* Special case for ID0: set the correct ID */
|
/* Special case for ID0: set the correct ID */
|
||||||
if (local.addr.id == msk->mpc_endpoint_id)
|
if (local.addr.id == msk->mpc_endpoint_id)
|
||||||
local.addr.id = 0;
|
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);
|
nr = fill_remote_addresses_vec(msk, &local.addr, fullmesh, addrs);
|
||||||
if (nr == 0)
|
if (nr == 0)
|
||||||
|
@ -758,7 +759,9 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
|
||||||
spin_lock_bh(&msk->pm.lock);
|
spin_lock_bh(&msk->pm.lock);
|
||||||
|
|
||||||
if (sf_created) {
|
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 ||
|
if (msk->pm.add_addr_accepted >= add_addr_accept_max ||
|
||||||
msk->pm.subflows >= subflows_max)
|
msk->pm.subflows >= subflows_max)
|
||||||
WRITE_ONCE(msk->pm.accept_addr, false);
|
WRITE_ONCE(msk->pm.accept_addr, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue