FAILED: patch "[PATCH] mptcp: corner case locking for rx path fields initialization" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x e4a0fa47e816e186f6b4c0055d07eeec42d11871
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024021905-routing-hurray-cc32@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
e4a0fa47e816 ("mptcp: corner case locking for rx path fields initialization") 3f83d8a77eee ("mptcp: fix more tx path fields initialization") 013e3179dbd2 ("mptcp: fix rcv space initialization")c693a8516429 ("mptcp: use mptcp_set_state")4fd19a307016 ("mptcp: fix inconsistent state on fastopen race") d109a7767273 ("mptcp: fix possible NULL pointer dereference on close") 8005184fd1ca ("mptcp: refactor sndbuf auto-tuning")a5efdbcece83 ("mptcp: fix delegated action races")27e5ccc2d5a5 ("mptcp: fix dangling connection hang-up") f6909dc1c1f4 ("mptcp: rename timer related helper to less confusing names") 9f1a98813b4b ("mptcp: process pending subflow error on close") d5fbeff1ab81 ("mptcp: move __mptcp_error_report in protocol.c") e3b2870b6d22 ("mptcp: add a new sysctl scheduler")ebc1e08f01eb ("mptcp: drop last_snd and MPTCP_RESET_SCHEDULER") e263691773cd ("mptcp: Remove unnecessary test for __mptcp_init_sock()") 39880bd808ad ("mptcp: get rid of msk->subflow")3f326a821b99 ("mptcp: change the mpc check helper to return a sk") 3aa362494170 ("mptcp: avoid ssock usage in mptcp_pm_nl_create_listen_socket()") f0bc514bd5c1 ("mptcp: avoid additional indirection in sockopt") 40f56d0c7043 ("mptcp: avoid additional indirection in mptcp_listen()")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e4a0fa47e816e186f6b4c0055d07eeec42d11871 Mon Sep 17 00:00:00 2001
From: Paolo Abeni <[email protected]>
Date: Thu, 8 Feb 2024 19:03:52 +0100
Subject: [PATCH] mptcp: corner case locking for rx path fields initialization
Most MPTCP-level related fields are under the mptcp data lock protection, but are written one-off without such lock at MPC complete time, both for the client and the server
Leverage the mptcp_propagate_state() infrastructure to move such initialization under the proper lock client-wise.
The server side critical init steps are done by mptcp_subflow_fully_established(): ensure the caller properly held the relevant lock, and avoid acquiring the same lock in the nested scopes.
There are no real potential races, as write access to such fields is implicitly serialized by the MPTCP state machine; the primary goal is consistency.
net/mptcp/fastopen.c +2 -4
@@ -59,13 +59,12 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subfmptcp_data_unlock (sk); } -void mptcp_fastopen_gen_msk_ackseq (struct mptcp_sock *msk,struct mptcp_subflow_context *subflow, -const struct mptcp_options_received *mp_opt) +void __mptcp_fastopen_gen_msk_ackseq (struct mptcp_sock *msk,struct mptcp_subflow_context *subflow, +const struct mptcp_options_received *mp_opt) {struct sock *sk = (struct sock *)msk;struct sk_buff *skb; -mptcp_data_lock (sk); skb =skb_peek_tail (&sk->sk_receive_queue);if (skb) {WARN_ON_ONCE (MPTCP_SKB_CB (skb)->end_seq);
@@ -77,5 +76,4 @@ void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_ }pr_debug ("msk=%p ack_seq=%llx" , msk, msk->ack_seq); -mptcp_data_unlock (sk); }
net/mptcp/options.c +5 -4
@@ -962,9 +962,7 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,/* subflows are fully established as soon as we get any * additional ack, including ADD_ADDR. */ - subflow->fully_established =1 ; -WRITE_ONCE (msk->fully_established, true); - goto check_notify; + goto set_fully_established; }/* If the first established packet does not contain MP_CAPABLE + data
@@ -986,7 +984,10 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, set_fully_established:if (unlikely (!READ_ONCE (msk->pm.server_side)))pr_warn_once ("bogus mpc option on established client sk" ); -mptcp_subflow_fully_established (subflow, mp_opt); + +mptcp_data_lock ((struct sock *)msk); +__mptcp_subflow_fully_established (msk, subflow, mp_opt); +mptcp_data_unlock ((struct sock *)msk); check_notify:/* if the subflow is not already linked into the conn_list, we can't
net/mptcp/protocol.c +6 -3
@@ -3186,6 +3186,7 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk, {struct mptcp_subflow_request_sock *subflow_req =mptcp_subflow_rsk (req);struct sock *nsk =sk_clone_lock (sk,GFP_ATOMIC ); +struct mptcp_subflow_context *subflow;struct mptcp_sock *msk;if (!nsk)
@@ -3226,7 +3227,8 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,/* The msk maintain a ref to each subflow in the connections list */ WRITE_ONCE (msk->first, ssk); -list_add (&mptcp_subflow_ctx (ssk)->node, &msk->conn_list); + subflow =mptcp_subflow_ctx (ssk); +list_add (&subflow->node, &msk->conn_list);sock_hold (ssk);/* new mpc subflow takes ownership of the newly
@@ -3241,6 +3243,9 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,__mptcp_propagate_sndbuf (nsk, ssk);mptcp_rcv_space_init (msk, ssk); + +if (mp_opt->suboptions &OPTION_MPTCP_MPC_ACK ) +__mptcp_subflow_fully_established (msk, subflow, mp_opt);bh_unlock_sock (nsk);/* note: the newly allocated socket refcount is 2 now */
@@ -3478,8 +3483,6 @@ void mptcp_finish_connect(struct sock *ssk)* accessing the field below */ WRITE_ONCE (msk->local_key, subflow->local_key); -WRITE_ONCE (msk->snd_una, subflow->idsn +1 ); -WRITE_ONCE (msk->wnd_end, subflow->idsn +1 +tcp_sk (ssk)->snd_wnd);mptcp_pm_new_connection (msk, ssk,0 ); }
net/mptcp/protocol.h +5 -4
@@ -622,8 +622,9 @@ unsigned int mptcp_stale_loss_cnt(const struct net *net);unsigned int mptcp_close_timeout (const struct sock *sk);int mptcp_get_pm_type (const struct net *net);const char *mptcp_get_scheduler (const struct net *net); -void mptcp_subflow_fully_established (struct mptcp_subflow_context *subflow, -const struct mptcp_options_received *mp_opt); +void __mptcp_subflow_fully_established (struct mptcp_sock *msk, +struct mptcp_subflow_context *subflow, +const struct mptcp_options_received *mp_opt);bool __mptcp_retransmit_pending_data (struct sock *sk);void mptcp_check_and_set_pending (struct sock *sk);void __mptcp_push_pending (struct sock *sk,unsigned int flags);
@@ -952,8 +953,8 @@ void mptcp_event_pm_listener(const struct sock *ssk, enum mptcp_event_type event);bool mptcp_userspace_pm_active (const struct mptcp_sock *msk); -void mptcp_fastopen_gen_msk_ackseq (struct mptcp_sock *msk,struct mptcp_subflow_context *subflow, -const struct mptcp_options_received *mp_opt); +void __mptcp_fastopen_gen_msk_ackseq (struct mptcp_sock *msk,struct mptcp_subflow_context *subflow, +const struct mptcp_options_received *mp_opt);void mptcp_fastopen_subflow_synack_set_params (struct mptcp_subflow_context *subflow,struct request_sock *req);
net/mptcp/subflow.c +32 -24
106 lines not on this page · raw message