[PATCH net 3/7] mptcp: use sk instead of casting msk in check_fully_established()

From: Matthieu Baerts (NGI0)

Date: Mon Nov 16 2026 - 17:09:24 EST


The MPTCP socket is cast to a struct sock in check_fully_established(),
to take its data lock. The next commits need it more, to push the
pending data.

Add a local 'sk' variable instead of casting msk each time: no
functional change.

The 'Fixes' tag here below is the same as the one from the next
commits: this patch is needed to fix the issues introduced by this
commit ID.

Fixes: 36b122baf6a8 ("mptcp: add subflow_v(4,6)_send_synack()")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
---
net/mptcp/options.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index a1e65309171e..1c58468b985b 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -982,6 +982,8 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,
struct sk_buff *skb,
struct mptcp_options_received *mp_opt)
{
+ struct sock *sk = (struct sock *)msk;
+
/* here we can process OoO, in-window pkts, only in-sequence 4th ack
* will make the subflow fully established
*/
@@ -1043,9 +1045,9 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,
if (mp_opt->deny_join_id0)
WRITE_ONCE(msk->pm.remote_deny_join_id0, true);

- mptcp_data_lock((struct sock *)msk);
+ mptcp_data_lock(sk);
__mptcp_subflow_fully_established(msk, subflow, mp_opt);
- mptcp_data_unlock((struct sock *)msk);
+ mptcp_data_unlock(sk);

check_notify:
/* if the subflow is not already linked into the conn_list, we can't

--
2.55.0