Skip to content

Commit 3277cf4

Browse files
Paolo Abenigregkh
authored andcommitted
mptcp: reset fallback status gracefully at disconnect() time
commit da9b2fc upstream. mptcp_disconnect() clears the fallback bit unconditionally, without touching the associated flags. The bit clear is safe, as no fallback operation can race with that -- all subflow are already in TCP_CLOSE status thanks to the previous FASTCLOSE -- but we need to consistently reset all the fallback related status. Also acquire the relevant lock, to avoid fouling static analyzers. Fixes: b29fcfb ("mptcp: full disconnect implementation") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250714-net-mptcp-fallback-races-v1-3-391aff963322@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 7c96d51 commit 3277cf4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

net/mptcp/protocol.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,7 +3208,16 @@ static int mptcp_disconnect(struct sock *sk, int flags)
32083208
* subflow
32093209
*/
32103210
mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE);
3211+
3212+
/* The first subflow is already in TCP_CLOSE status, the following
3213+
* can't overlap with a fallback anymore
3214+
*/
3215+
spin_lock_bh(&msk->fallback_lock);
3216+
msk->allow_subflows = true;
3217+
msk->allow_infinite_fallback = true;
32113218
WRITE_ONCE(msk->flags, 0);
3219+
spin_unlock_bh(&msk->fallback_lock);
3220+
32123221
msk->cb_flags = 0;
32133222
msk->recovery = false;
32143223
msk->can_ack = false;

0 commit comments

Comments
 (0)