mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
mptcp: avoid unneeded actions on subflow reset
Once in a blue moon, the mptcp receive path can recursively call
mptcp_data_ready() via state change under unlucky error conditions, and
then try to hold the data lock again.
Break the recursion loop explicitly checking for the exceptional
condition.
Add a new flag instead of using an existing one like 'closing', to exit
early in subflow_state_change(), and explicitly flush the RX queue at
reset time.
This avoids unneeded processing to check for available data -- calling
get_mapping_status() and more on a dying subflow -- but also in error
reporting and worker scheduling.
Note that we must consume the currently peeked skb before invoking
mptcp_dss_corruption to avoid consuming it again after the eventual
reset has freed it.
Fixes: e32d262c89 ("mptcp: handle consistently DSS corruption")
Cc: stable@vger.kernel.org
Reported-by: Xinyang Ge <xinyang@anthropic.com>
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/20260917-net-mptcp-misc-fixes-7-3-rc4-v2-1-0cf5c72667c8@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a5117e1ecc
commit
2b0f561f21
|
|
@ -856,12 +856,12 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
|
|||
mptcp_dss_corruption(msk, ssk);
|
||||
}
|
||||
} else {
|
||||
sk_eat_skb(ssk, skb);
|
||||
|
||||
if (unlikely(!fin)) {
|
||||
DEBUG_NET_WARN_ON_ONCE(1);
|
||||
mptcp_dss_corruption(msk, ssk);
|
||||
}
|
||||
|
||||
sk_eat_skb(ssk, skb);
|
||||
}
|
||||
|
||||
WRITE_ONCE(tp->copied_seq, seq);
|
||||
|
|
|
|||
|
|
@ -585,7 +585,8 @@ struct mptcp_subflow_context {
|
|||
is_mptfo : 1, /* subflow is doing TFO */
|
||||
close_event_done : 1, /* has done the post-closed part */
|
||||
mpc_drop : 1, /* the MPC option has been dropped in a rtx */
|
||||
__unused : 9;
|
||||
resetting : 1, /* subflow is resetting */
|
||||
__unused : 8;
|
||||
bool data_avail;
|
||||
bool scheduled;
|
||||
bool pm_listener; /* a listener managed by the kernel PM? */
|
||||
|
|
|
|||
|
|
@ -438,6 +438,10 @@ void mptcp_subflow_reset(struct sock *ssk)
|
|||
/* must hold: tcp_done() could drop last reference on parent */
|
||||
sock_hold(sk);
|
||||
|
||||
subflow->resetting = 1;
|
||||
|
||||
/* No need to delay the actual close for to-be discarded data. */
|
||||
__skb_queue_purge(&ssk->sk_receive_queue);
|
||||
mptcp_send_active_reset_reason(ssk);
|
||||
tcp_done(ssk);
|
||||
if (!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &mptcp_sk(sk)->flags))
|
||||
|
|
@ -1883,6 +1887,13 @@ static void subflow_state_change(struct sock *sk)
|
|||
|
||||
__subflow_state_change(sk);
|
||||
|
||||
/* Rx queue processing is unneeded, error reporting will take place at
|
||||
* __mptcp_close_ssk() time and subflow reset can't happen in case of
|
||||
* fallback: subflow_sched_work_if_closed() would be a no-op.
|
||||
*/
|
||||
if (subflow->resetting)
|
||||
return;
|
||||
|
||||
/* as recvmsg() does not acquire the subflow socket for ssk selection
|
||||
* a fin packet carrying a DSS can be unnoticed if we don't trigger
|
||||
* the data available machinery here.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user