* [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7
@ 2026-06-01 3:09 Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 01/10] mptcp: fix missing wakeups in edge scenarios Matthieu Baerts (NGI0)
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:09 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable, Tao Cui, Shuah Khan, Willem de Bruijn,
Sebastian Andrzej Siewior, Clark Williams, Steven Rostedt,
Hannes Reinecke, linux-rt-devel, Gang Yan
Here are various unrelated fixes:
- Patch 1: fix missing wakeups when multiple threads are reading from
the same fd. A fix for v5.7.
- Patch 2: fix retransmission loop when MPTCP checksum is enabled. A fix
for v5.14.
- Patch 3: fix a TOCTOU race while computing rcv_wnd. A fix for v5.11.
- Patch 4: allow subflows receive window to shrink if needed. A fix for
v5.19.
- Patches 5-6: avoid 'extra_subflows' to underflow with the userspace
PM. A fix for v5.19.
- Patch 7: report errors if one subflow cannot set SO_TIMESTAMPING. A
fix for v5.14.
- Patch 8: try to set TCP_MAXSEG on all subflows, before reporting
errors, if any. A fix for v6.17.
- Patch 9: avoid a lockdep splat when PREEMPT_RT is used. A fix for
v5.10.
- Patch 10: check desc->count in read_sock, to act as expected. A fix
for v7.0.
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Gang Yan (1):
mptcp: check desc->count in read_sock
Matthieu Baerts (NGI0) (3):
mptcp: sockopt: check timestamping ret value
mptcp: sockopt: set sockopt on all subflows
mptcp: pm: avoid sleeping while holding rcu_read_lock
Paolo Abeni (4):
mptcp: fix missing wakeups in edge scenarios
mptcp: fix retransmission loop when csum is enabled
mptcp: close TOCTOU race while computing rcv_wnd
mptcp: allow subflow rcv wnd to shrink
Tao Cui (2):
mptcp: pm: fix extra_subflows underflow on userspace PM subflow creation
selftests: mptcp: add test for extra_subflows underflow on userspace PM
net/mptcp/options.c | 43 ++++++++++++++-----------
net/mptcp/pm.c | 18 +++++------
net/mptcp/pm_userspace.c | 14 ++++----
net/mptcp/protocol.c | 10 ++++++
net/mptcp/sockopt.c | 15 ++++++---
tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 +++
6 files changed, 66 insertions(+), 38 deletions(-)
---
base-commit: 78ef59e7a6459b16f8102e0ee1c718443323d1af
change-id: 20260531-net-mptcp-misc-fixes-7-1-rc7-34884c9b246d
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 01/10] mptcp: fix missing wakeups in edge scenarios
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
@ 2026-06-01 3:09 ` Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 02/10] mptcp: fix retransmission loop when csum is enabled Matthieu Baerts (NGI0)
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:09 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable
From: Paolo Abeni <pabeni@redhat.com>
The mptcp_recvmsg() can fill MPTCP socket receive queue via
mptcp_move_skbs(), but currently does not try to wakeup any listener,
because the same process is going to check the receive queue soon.
When multiple threads are reading from the same fd, the above can
cause stall. Add the missing wakeup.
Fixes: 6771bfd9ee24 ("mptcp: update mptcp ack sequence from work queue")
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>
---
net/mptcp/protocol.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index a72a6ad6ee8b..5a20ab2789ae 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2276,6 +2276,10 @@ static bool mptcp_move_skbs(struct sock *sk)
mptcp_backlog_spooled(sk, moved, &skbs);
}
mptcp_data_unlock(sk);
+
+ if (enqueued && mptcp_epollin_ready(sk))
+ sk->sk_data_ready(sk);
+
return enqueued;
}
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 02/10] mptcp: fix retransmission loop when csum is enabled
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 01/10] mptcp: fix missing wakeups in edge scenarios Matthieu Baerts (NGI0)
@ 2026-06-01 3:09 ` Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 03/10] mptcp: close TOCTOU race while computing rcv_wnd Matthieu Baerts (NGI0)
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:09 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable
From: Paolo Abeni <pabeni@redhat.com>
Sashiko noted that retransmission with csum enabled can actually
transmit new data, but currently the relevant code does not update
accordingly snd_nxt.
The may cause incoming ack drop and an endless retransmission loop.
Address the issue incrementing snd_nxt as needed.
Fixes: 4e14867d5e91 ("mptcp: tune re-injections for csum enabled mode")
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>
---
net/mptcp/protocol.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 5a20ab2789ae..7fac5fac2097 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2869,6 +2869,10 @@ static void __mptcp_retrans(struct sock *sk)
msk->bytes_retrans += len;
dfrag->already_sent = max(dfrag->already_sent, len);
+ /* With csum enabled retransmission can send new data. */
+ if (after64(dfrag->already_sent + dfrag->data_seq, msk->snd_nxt))
+ WRITE_ONCE(msk->snd_nxt, dfrag->already_sent + dfrag->data_seq);
+
reset_timer:
mptcp_check_and_set_pending(sk);
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 03/10] mptcp: close TOCTOU race while computing rcv_wnd
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 01/10] mptcp: fix missing wakeups in edge scenarios Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 02/10] mptcp: fix retransmission loop when csum is enabled Matthieu Baerts (NGI0)
@ 2026-06-01 3:09 ` Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 04/10] mptcp: allow subflow rcv wnd to shrink Matthieu Baerts (NGI0)
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:09 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable
From: Paolo Abeni <pabeni@redhat.com>
The MPTCP output path access locklessly the MPTCP-level ack_seq
in multiple times, using possibly different values for the data_ack
in the DSS option and to compute the announced rcv wnd for the same
packet.
Refactor the cote to avoid inconsistencies which may confuse the
peer. Also ensure that the MPTCP level rcv wnd is updated only when
the egress packet actually contains a DSS ack.
Fixes: fa3fe2b15031 ("mptcp: track window announced to peer")
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>
---
net/mptcp/options.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 8a1c5698983c..5c228344e83f 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -570,7 +570,6 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
struct mptcp_ext *mpext;
unsigned int ack_size;
bool ret = false;
- u64 ack_seq;
opts->csum_reqd = READ_ONCE(msk->csum_enabled);
mpext = skb ? mptcp_get_ext(skb) : NULL;
@@ -601,14 +600,11 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
return ret;
}
- ack_seq = READ_ONCE(msk->ack_seq);
if (READ_ONCE(msk->use_64bit_ack)) {
ack_size = TCPOLEN_MPTCP_DSS_ACK64;
- opts->ext_copy.data_ack = ack_seq;
opts->ext_copy.ack64 = 1;
} else {
ack_size = TCPOLEN_MPTCP_DSS_ACK32;
- opts->ext_copy.data_ack32 = (uint32_t)ack_seq;
opts->ext_copy.ack64 = 0;
}
opts->ext_copy.use_ack = 1;
@@ -1297,19 +1293,14 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
return true;
}
-static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
+static u64 mptcp_set_rwin(struct mptcp_sock *msk, struct tcp_sock *tp,
+ struct tcphdr *th, u64 ack_seq)
{
const struct sock *ssk = (const struct sock *)tp;
- struct mptcp_subflow_context *subflow;
- u64 ack_seq, rcv_wnd_old, rcv_wnd_new;
- struct mptcp_sock *msk;
+ u64 rcv_wnd_old, rcv_wnd_new;
u32 new_win;
u64 win;
- subflow = mptcp_subflow_ctx(ssk);
- msk = mptcp_sk(subflow->conn);
-
- ack_seq = READ_ONCE(msk->ack_seq);
rcv_wnd_new = ack_seq + tp->rcv_wnd;
rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent);
@@ -1362,7 +1353,7 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
update_wspace:
WRITE_ONCE(msk->old_wspace, tp->rcv_wnd);
- subflow->rcv_wnd_sent = rcv_wnd_new;
+ return rcv_wnd_new;
}
static void mptcp_track_rwin(struct tcp_sock *tp)
@@ -1474,13 +1465,25 @@ void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp,
*ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags);
if (mpext->use_ack) {
+ struct mptcp_sock *msk;
+ u64 ack_seq;
+
+ /* DSS option is set only by mptcp_established_option,
+ * the caller is __tcp_transmit_skb() and ssk is always
+ * not NULL.
+ */
+ subflow = mptcp_subflow_ctx(ssk);
+ msk = mptcp_sk(subflow->conn);
+ ack_seq = READ_ONCE(msk->ack_seq);
if (mpext->ack64) {
- put_unaligned_be64(mpext->data_ack, ptr);
+ put_unaligned_be64(ack_seq, ptr);
ptr += 2;
} else {
- put_unaligned_be32(mpext->data_ack32, ptr);
+ put_unaligned_be32(ack_seq, ptr);
ptr += 1;
}
+ subflow->rcv_wnd_sent = mptcp_set_rwin(msk, tp, th,
+ ack_seq);
}
if (mpext->use_map) {
@@ -1708,9 +1711,6 @@ void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp,
i += 4;
}
}
-
- if (tp)
- mptcp_set_rwin(tp, th);
}
__be32 mptcp_get_reset_option(const struct sk_buff *skb)
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 04/10] mptcp: allow subflow rcv wnd to shrink
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
` (2 preceding siblings ...)
2026-06-01 3:09 ` [PATCH net 03/10] mptcp: close TOCTOU race while computing rcv_wnd Matthieu Baerts (NGI0)
@ 2026-06-01 3:10 ` Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 05/10] mptcp: pm: fix extra_subflows underflow on userspace PM subflow creation Matthieu Baerts (NGI0)
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:10 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable
From: Paolo Abeni <pabeni@redhat.com>
In MPTCP connection, the `window` field in the TCP header refers to the
MPTCP-level rcv_nxt and it's right edge should not move backward. Such
constraint is enforced at DSS option generation time.
At the same time, the TCP stack ensures independently that the TCP-level
rcv wnd right's edge does not move backward. That in turn causes artificial
inflating of the MPTCP rcv window when the incoming data is acked at the
TCP level and is OoO in the MPTCP sequence space (or lands in the backlog).
As a consequence, the incoming traffic can exceed the receiver rcvbuf size
even when the sender is not misbehaving.
Prevent such scenario forcibly allowing the TCP subflow to shrink the
TCP-level rcv wnd regardless of the current netns setting.
Fixes: f3589be0c420 ("mptcp: never shrink offered window")
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>
---
net/mptcp/options.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 5c228344e83f..12cbd98c7111 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -566,6 +566,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
{
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
+ struct tcp_sock *tp = tcp_sk(sk);
unsigned int dss_size = 0;
struct mptcp_ext *mpext;
unsigned int ack_size;
@@ -614,6 +615,12 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
if (dss_size == 0)
ack_size += TCPOLEN_MPTCP_DSS_BASE;
+ /* The caller is __tcp_transmit_skb(), and will compute the new rcv
+ * wnd soon: ensure that the window can shrink.
+ */
+ if (skb)
+ tp->rcv_wnd = tp->rcv_nxt - tp->rcv_wup;
+
dss_size += ack_size;
*size = ALIGN(dss_size, 4);
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 05/10] mptcp: pm: fix extra_subflows underflow on userspace PM subflow creation
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
` (3 preceding siblings ...)
2026-06-01 3:10 ` [PATCH net 04/10] mptcp: allow subflow rcv wnd to shrink Matthieu Baerts (NGI0)
@ 2026-06-01 3:10 ` Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 06/10] selftests: mptcp: add test for extra_subflows underflow on userspace PM Matthieu Baerts (NGI0)
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:10 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
Tao Cui, stable
From: Tao Cui <cuitao@kylinos.cn>
The userspace PM increments extra_subflows after __mptcp_subflow_connect()
succeeds, but __mptcp_subflow_connect() calls mptcp_pm_close_subflow()
on failure to roll back the pre-increment done by the kernel PM's fill_*()
helpers. Because the userspace PM hasn't incremented yet at that point,
this decrement is spurious and causes extra_subflows to underflow.
Fix it by aligning the userspace PM with the kernel PM: increment
extra_subflows before calling __mptcp_subflow_connect(), so the existing
error path in subflow.c correctly rolls it back on failure. Also simplify
the error handling by taking pm.lock only when needed for cleanup.
Fixes: 77e4b94a3de6 ("mptcp: update userspace pm infos")
Cc: stable@vger.kernel.org
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/pm_userspace.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index 8cbc1920afb4..0d3a95e676f1 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -408,19 +408,21 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
local.flags = entry.flags;
local.ifindex = entry.ifindex;
+ spin_lock_bh(&msk->pm.lock);
+ msk->pm.extra_subflows++;
+ spin_unlock_bh(&msk->pm.lock);
+
lock_sock(sk);
err = __mptcp_subflow_connect(sk, &local, &addr_r);
release_sock(sk);
- if (err)
+ if (err) {
GENL_SET_ERR_MSG_FMT(info, "connect error: %d", err);
- spin_lock_bh(&msk->pm.lock);
- if (err)
+ spin_lock_bh(&msk->pm.lock);
mptcp_userspace_pm_delete_local_addr(msk, &entry);
- else
- msk->pm.extra_subflows++;
- spin_unlock_bh(&msk->pm.lock);
+ spin_unlock_bh(&msk->pm.lock);
+ }
create_err:
sock_put(sk);
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 06/10] selftests: mptcp: add test for extra_subflows underflow on userspace PM
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
` (4 preceding siblings ...)
2026-06-01 3:10 ` [PATCH net 05/10] mptcp: pm: fix extra_subflows underflow on userspace PM subflow creation Matthieu Baerts (NGI0)
@ 2026-06-01 3:10 ` Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 07/10] mptcp: sockopt: check timestamping ret value Matthieu Baerts (NGI0)
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:10 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
Tao Cui, stable, Shuah Khan
From: Tao Cui <cuitao@kylinos.cn>
Add a test to verify that when userspace PM fails to create a subflow
(e.g. using an unreachable address), the extra_subflows counter is not
decremented below zero.
Fixes: 77e4b94a3de6 ("mptcp: update userspace pm infos")
Cc: stable@vger.kernel.org
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
To: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
---
tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 5acd12021e6e..4b3f71e66609 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -4100,6 +4100,10 @@ userspace_tests()
chk_rm_nr 0 1
chk_mptcp_info subflows 0 subflows 0
chk_subflows_total 1 1
+ # check counters are not affected by errors at creation time
+ userspace_pm_add_sf $ns2 10.0.12.2 10 2>/dev/null
+ chk_mptcp_info subflows 0 subflows 0
+ chk_subflows_total 1 1
kill_events_pids
mptcp_lib_kill_group_wait $tests_pid
fi
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 07/10] mptcp: sockopt: check timestamping ret value
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
` (5 preceding siblings ...)
2026-06-01 3:10 ` [PATCH net 06/10] selftests: mptcp: add test for extra_subflows underflow on userspace PM Matthieu Baerts (NGI0)
@ 2026-06-01 3:10 ` Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 08/10] mptcp: sockopt: set sockopt on all subflows Matthieu Baerts (NGI0)
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:10 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable, Willem de Bruijn
sock_set_timestamping() can fail for different reasons. The returned
value should then be checked.
If sock_set_timestamping() fails for at least one subflow, the first
error is now reported to the userspace, similar to what is done with
other socket options.
Fixes: 9061f24bf82e ("mptcp: sockopt: propagate timestamp request to subflows")
Cc: stable@vger.kernel.org
Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Closes: https://lore.kernel.org/willemdebruijn.kernel.178a41a53d041@gmail.com
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/sockopt.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index 87b5796d0135..91aa57f1d0fd 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -241,15 +241,19 @@ static int mptcp_setsockopt_sol_socket_timestamping(struct mptcp_sock *msk,
mptcp_for_each_subflow(msk, subflow) {
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+ int err;
lock_sock(ssk);
- sock_set_timestamping(ssk, optname, timestamping);
+ err = sock_set_timestamping(ssk, optname, timestamping);
release_sock(ssk);
+
+ if (err < 0 && ret == 0)
+ ret = err;
}
release_sock(sk);
- return 0;
+ return ret;
}
static int mptcp_setsockopt_sol_socket_linger(struct mptcp_sock *msk, sockptr_t optval,
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 08/10] mptcp: sockopt: set sockopt on all subflows
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
` (6 preceding siblings ...)
2026-06-01 3:10 ` [PATCH net 07/10] mptcp: sockopt: check timestamping ret value Matthieu Baerts (NGI0)
@ 2026-06-01 3:10 ` Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 09/10] mptcp: pm: avoid sleeping while holding rcu_read_lock Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 10/10] mptcp: check desc->count in read_sock Matthieu Baerts (NGI0)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:10 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable
The mptcp_setsockopt_all_sf(), currently used only with TCP_MAXSEG,
stopped when one subflow returned an error.
Even if it is not wrong, this is different from the other helpers trying
to set the option on all subflows, and then returning an error if at
least one of them had an issue.
Follow this behaviour, for a question of uniformity.
Fixes: 51c5fd09e1b4 ("mptcp: add TCP_MAXSEG sockopt support")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/sockopt.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index 91aa57f1d0fd..fcf6feb2a9eb 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -817,10 +817,11 @@ static int mptcp_setsockopt_all_sf(struct mptcp_sock *msk, int level,
mptcp_for_each_subflow(msk, subflow) {
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+ int err;
- ret = tcp_setsockopt(ssk, level, optname, optval, optlen);
- if (ret)
- break;
+ err = tcp_setsockopt(ssk, level, optname, optval, optlen);
+ if (err < 0 && ret == 0)
+ ret = err;
}
if (!ret)
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 09/10] mptcp: pm: avoid sleeping while holding rcu_read_lock
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
` (7 preceding siblings ...)
2026-06-01 3:10 ` [PATCH net 08/10] mptcp: sockopt: set sockopt on all subflows Matthieu Baerts (NGI0)
@ 2026-06-01 3:10 ` Matthieu Baerts (NGI0)
2026-06-01 6:58 ` Sebastian Andrzej Siewior
2026-06-01 3:10 ` [PATCH net 10/10] mptcp: check desc->count in read_sock Matthieu Baerts (NGI0)
9 siblings, 1 reply; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:10 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
stable, Sebastian Andrzej Siewior, Clark Williams,
Steven Rostedt, Hannes Reinecke, linux-rt-devel
sk_stop_timer_sync() calls del_timer_sync(), which spin-waits for the
timer callback to complete on non-RT kernels. But on PREEMPT_RT, it can
sleep. Sleeping inside an RCU read-side critical section might trigger a
lockdep splat.
Instead, keep a reference to the timer, under rcu_read_lock, and call
sk_stop_timer*() without the RCU lock.
While at it, apply the reversed Xmas order when declaring variables.
Fixes: 426358d9be7c ("mptcp: fix a race in mptcp_pm_del_add_timer()")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Clark Williams <clrkwllms@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
To: Hannes Reinecke <hare@kernel.org>
Cc: linux-rt-devel@lists.linux.dev
---
net/mptcp/pm.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index 3e770c7407e1..1e0866159972 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -401,9 +401,9 @@ struct mptcp_pm_add_entry *
mptcp_pm_del_add_timer(struct mptcp_sock *msk,
const struct mptcp_addr_info *addr, bool check_id)
{
- struct mptcp_pm_add_entry *entry;
struct sock *sk = (struct sock *)msk;
- bool stop_timer = false;
+ struct mptcp_pm_add_entry *entry;
+ struct timer_list *timer = NULL;
rcu_read_lock();
@@ -411,7 +411,7 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,
entry = mptcp_lookup_anno_list_by_saddr(msk, addr);
if (entry && (!check_id || entry->addr.id == addr->id)) {
entry->retrans_times = ADD_ADDR_RETRANS_MAX;
- stop_timer = true;
+ timer = &entry->add_timer;
}
if (!check_id && entry)
list_del(&entry->list);
@@ -420,14 +420,14 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,
/* Note: entry might have been removed by another thread.
* We hold rcu_read_lock() to ensure it is not freed under us.
*/
- if (stop_timer) {
- if (check_id)
- sk_stop_timer(sk, &entry->add_timer);
- else
- sk_stop_timer_sync(sk, &entry->add_timer);
- }
+ if (timer && check_id)
+ sk_stop_timer(sk, timer);
rcu_read_unlock();
+
+ if (timer && !check_id)
+ sk_stop_timer_sync(sk, timer);
+
return entry;
}
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net 10/10] mptcp: check desc->count in read_sock
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
` (8 preceding siblings ...)
2026-06-01 3:10 ` [PATCH net 09/10] mptcp: pm: avoid sleeping while holding rcu_read_lock Matthieu Baerts (NGI0)
@ 2026-06-01 3:10 ` Matthieu Baerts (NGI0)
9 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-06-01 3:10 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal
Cc: netdev, mptcp, linux-kernel, linux-kselftest,
Matthieu Baerts (NGI0),
Gang Yan, stable
From: Gang Yan <yangang@kylinos.cn>
__tcp_read_sock() checks desc->count after each skb is consumed and
breaks the loop when it reaches 0. The MPTCP variant lacks this check.
This is a functional bug, other subsystems also rely on this check:
TLS strparser sets desc->count to 0 once a full TLS record is assembled
and depends on this break to stop reading.
Add the same desc->count check to __mptcp_read_sock(), mirroring
__tcp_read_sock().
Fixes: 250d9766a984 ("mptcp: implement .read_sock")
Cc: stable@vger.kernel.org
Co-developed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Gang Yan <yangang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/protocol.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 7fac5fac2097..cb9515f505aa 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4428,6 +4428,8 @@ static int __mptcp_read_sock(struct sock *sk, read_descriptor_t *desc,
}
mptcp_eat_recv_skb(sk, skb);
+ if (!desc->count)
+ break;
}
if (noack)
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 09/10] mptcp: pm: avoid sleeping while holding rcu_read_lock
2026-06-01 3:10 ` [PATCH net 09/10] mptcp: pm: avoid sleeping while holding rcu_read_lock Matthieu Baerts (NGI0)
@ 2026-06-01 6:58 ` Sebastian Andrzej Siewior
2026-06-01 7:27 ` Matthieu Baerts
0 siblings, 1 reply; 13+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-06-01 6:58 UTC (permalink / raw)
To: Matthieu Baerts (NGI0)
Cc: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal,
netdev, mptcp, linux-kernel, linux-kselftest, stable,
Clark Williams, Steven Rostedt, Hannes Reinecke, linux-rt-devel
On 2026-06-01 13:10:05 [+1000], Matthieu Baerts (NGI0) wrote:
> sk_stop_timer_sync() calls del_timer_sync(), which spin-waits for the
There is no del_timer_sync()
> timer callback to complete on non-RT kernels. But on PREEMPT_RT, it can
> sleep. Sleeping inside an RCU read-side critical section might trigger a
> lockdep splat.
It can not sleep. timer_delete_sync() does not sleep. It can block on
spinlock_t and schedule but this is okay within a RCU read section.
Do you have a report for this?
Sebastian
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net 09/10] mptcp: pm: avoid sleeping while holding rcu_read_lock
2026-06-01 6:58 ` Sebastian Andrzej Siewior
@ 2026-06-01 7:27 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2026-06-01 7:27 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal,
netdev, mptcp, linux-kernel, linux-kselftest, stable,
Clark Williams, Steven Rostedt, Hannes Reinecke, linux-rt-devel
Hi Sebastian,
Thank you for the review!
On 01/06/2026 16:58, Sebastian Andrzej Siewior wrote:
> On 2026-06-01 13:10:05 [+1000], Matthieu Baerts (NGI0) wrote:
>> sk_stop_timer_sync() calls del_timer_sync(), which spin-waits for the
> There is no del_timer_sync()
Indeed, not sure why I put that one. I wanted to say timer_delete_sync()
>> timer callback to complete on non-RT kernels. But on PREEMPT_RT, it can
>> sleep. Sleeping inside an RCU read-side critical section might trigger a
>> lockdep splat.
>
> It can not sleep. timer_delete_sync() does not sleep. It can block on
> spinlock_t and schedule but this is okay within a RCU read section.
Sorry, I got confused by the comment in __timer_delete_sync().
> Do you have a report for this?
No, sorry. I was exploring the code in timer.c after a related comment
from Sashiko [1]. I noticed the comment in __timer_delete_sync() about
being able to sleep on PREEMPT_RT, then saw that timer_delete_sync() was
called inside a rcu_read_lock(), and I thought it was wrong. I should
have tried to reproduce the warning on PREEMPT_RT, but I switched to the
next bug instead :-/
Sorry for the noise, let's drop this patch if it is not needed then.
[1] https://github.com/multipath-tcp/mptcp_net-next/issues/623
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-06-01 7:27 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-01 3:09 [PATCH net 00/10] mptcp: misc fixes for v7.1-rc7 Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 01/10] mptcp: fix missing wakeups in edge scenarios Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 02/10] mptcp: fix retransmission loop when csum is enabled Matthieu Baerts (NGI0)
2026-06-01 3:09 ` [PATCH net 03/10] mptcp: close TOCTOU race while computing rcv_wnd Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 04/10] mptcp: allow subflow rcv wnd to shrink Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 05/10] mptcp: pm: fix extra_subflows underflow on userspace PM subflow creation Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 06/10] selftests: mptcp: add test for extra_subflows underflow on userspace PM Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 07/10] mptcp: sockopt: check timestamping ret value Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 08/10] mptcp: sockopt: set sockopt on all subflows Matthieu Baerts (NGI0)
2026-06-01 3:10 ` [PATCH net 09/10] mptcp: pm: avoid sleeping while holding rcu_read_lock Matthieu Baerts (NGI0)
2026-06-01 6:58 ` Sebastian Andrzej Siewior
2026-06-01 7:27 ` Matthieu Baerts
2026-06-01 3:10 ` [PATCH net 10/10] mptcp: check desc->count in read_sock Matthieu Baerts (NGI0)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®