net/mptcp/options.c | 4 ++-- net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
This is a note to let you know that I've just added the patch titled
mptcp: annotate data-races around subflow->fully_established
to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mptcp-annotate-data-races-around-subflow-fully_established.patch
and it can be found in the queue-6.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From stable+bounces-338598-greg=kroah.com@vger.kernel.org Sat Sep 19 21:57:10 2026
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Date: Sat, 19 Sep 2026 21:56:44 +0200
Subject: mptcp: annotate data-races around subflow->fully_established
To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org
Cc: Gang Yan <yangang@kylinos.cn>, sashal@kernel.org, "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, Jakub Kicinski <kuba@kernel.org>
Message-ID: <20260919195642.1977885-8-matttbe@kernel.org>
From: Gang Yan <yangang@kylinos.cn>
commit 581c8cbfa934aaa555daa4e843242fcecc160f05 upstream.
We introduce the same handling for potential data races with the
'fully_established' flag in subflow as previously done for
msk->fully_established.
Additionally, we make a crucial change: convert the subflow's
'fully_established' from 'bit_field' to 'bool' type. This is
necessary because methods for avoiding data races don't work well
with 'bit_field'. Specifically, the 'READ_ONCE' needs to know
the size of the variable being accessed, which is not supported in
'bit_field'. Also, 'test_bit' expect the address of 'bit_field'.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/516
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>
Link: https://patch.msgid.link/20241021-net-next-mptcp-misc-6-13-v1-2-1ef02746504a@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 2b0f561f21b2 ("mptcp: avoid unneeded actions on subflow reset")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mptcp/options.c | 4 ++--
net/mptcp/protocol.c | 2 +-
net/mptcp/protocol.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -532,7 +532,7 @@ static bool mptcp_established_options_mp
return false;
/* MPC/MPJ needed only on 3rd ack packet, DATA_FIN and TCP shutdown take precedence */
- if (subflow->fully_established || snd_data_fin_enable ||
+ if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable ||
subflow->snd_isn != TCP_SKB_CB(skb)->seq ||
sk->sk_state != TCP_ESTABLISHED)
return false;
@@ -999,7 +999,7 @@ static bool check_fully_established(stru
/* here we can process OoO, in-window pkts, only in-sequence 4th ack
* will make the subflow fully established
*/
- if (likely(subflow->fully_established)) {
+ if (likely(READ_ONCE(subflow->fully_established))) {
/* on passive sockets, check for 3rd ack retransmission
* note that msk is always set by subflow_syn_recv_sock()
* for mp_join subflows
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3685,7 +3685,7 @@ static void schedule_3rdack_retransmissi
struct tcp_sock *tp = tcp_sk(ssk);
unsigned long timeout;
- if (mptcp_subflow_ctx(ssk)->fully_established)
+ if (READ_ONCE(mptcp_subflow_ctx(ssk)->fully_established))
return;
/* reschedule with a timeout above RTT, as we must look only for drop */
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -545,7 +545,7 @@ 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 : 8;
+ __unused : 9;
bool data_avail;
bool scheduled;
bool pm_listener; /* a listener managed by the kernel PM? */
Patches currently in stable-queue which might be from matttbe@kernel.org are
queue-6.12/mptcp-annotate-data-races-around-subflow-fully_established.patch
queue-6.12/selftests-mptcp-fix-an-uaf-in-mptcp_connect.c.patch
queue-6.12/mptcp-fix-bad-accounting-in-__mptcp_subflow_push_pending.patch
queue-6.12/mptcp-syncookies-remember-the-request-backup-flag.patch
queue-6.12/mptcp-remove-unneeded-read_once-annotation.patch
queue-6.12/mptcp-close-race-between-scheduler-and-state-change.patch
queue-6.12/tcp-use-gfp_atomic-in-tcp_send_active_reset.patch
queue-6.12/mptcp-avoid-unneeded-actions-on-subflow-reset.patch
queue-6.12/mptcp-options-handle-mpc-data-csum-reqd-no-csum.patch
queue-6.12/mptcp-subflow-no-need-to-copy-thmac-during-ulp_clone.patch
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mptcp: build failure due to READ_ONCE() on bit-field
--
commit 2cede4d0675228e6db5b209f56d2a298cf7cb2e9
Author: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
Subject: Patch "mptcp: annotate data-races around subflow->fully_established" has been added to the 6.12-stable tree
This commit annotates data races around the fully_established flag in the
mptcp subflow context. It aims to convert the flag from a bit-field to a
boolean type to safely use READ_ONCE() and WRITE_ONCE().
Link: https://patch.msgid.link/20241021-net-next-mptcp-misc-6-13-v1-2-1ef02746504a@kernel.org
> Additionally, we make a crucial change: convert the subflow's
> 'fully_established' from 'bit_field' to 'bool' type. This is
> necessary because methods for avoiding data races don't work well
> with 'bit_field'. Specifically, the 'READ_ONCE' needs to know
> the size of the variable being accessed, which is not supported in
> 'bit_field'. Also, 'test_bit' expect the address of 'bit_field'.
[Severity: Low]
Was the hunk converting this field to a boolean dropped during the backport?
It appears fully_established is still defined as a bit-field in
struct mptcp_subflow_context.
Additionally, the write side update was missed in the backport:
net/mptcp/subflow.c:__mptcp_subflow_fully_established() {
...
subflow->fully_established = 1;
...
}
This lacks the WRITE_ONCE() annotation and continues to perform an unsafe
read-modify-write on the shared bit-field word.
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 370c3836b7712..1603b3702e220 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -461,7 +461,7 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb,
> return false;
>
> /* MPC/MPJ needed only on 3rd ack packet, DATA_FIN and TCP shutdown take precedence */
> - if (subflow->fully_established || snd_data_fin_enable ||
> + if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable ||
[Severity: Low]
Does this trigger a compiler error? Since the struct modification was missed
and fully_established remains a bit-field, applying READ_ONCE() here attempts
to take the address of a bit-field, which is syntactically invalid in C.
[ ... ]
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 568a72702b080..e9dba0708ee70 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -532,7 +532,7 @@ 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 : 8;
> + __unused : 9;
[Severity: Low]
Does this increase the total bit-field group to 33 bits, causing a boundary
overflow?
Since fully_established wasn't actually removed from the bit-field group in
this backport, incrementing the unused bits to 9 pushes the total beyond a
32-bit word size.
> bool data_avail;
> bool scheduled;
> bool pm_listener; /* a listener managed by the kernel PM? */
--
Sashiko AI review · https://sashiko.dev/#/patchset/2026092037-islamic-default-0aca@gregkh?part=1
Hello,
On 20/09/2026 09:48, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] mptcp: build failure due to READ_ONCE() on bit-field
Mmh, I missed the fact this commit has already been backported in commit
477aa7116a76 ("mptcp: annotate data-races around subflow
->fully_established"), but mostly reverted by caa4a79f74f3 ("mptcp:
remove unneeded READ_ONCE() annotation").
I don't know what's better here: either we leave it like that, and I can
fix the size of the bit-field. Or we drop patch 1 and 2, and I resolve
the small conflict on patch 3/5: commit 2b0f561f21b2 ("mptcp: avoid
unneeded actions on subflow reset"). I can send a v2, and we can drop it
if the other solution has been preferred.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
On Sun, Sep 20, 2026 at 11:33:47AM +0200, Matthieu Baerts wrote:
> Hello,
>
> On 20/09/2026 09:48, sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > - [Low] mptcp: build failure due to READ_ONCE() on bit-field
>
> Mmh, I missed the fact this commit has already been backported in commit
> 477aa7116a76 ("mptcp: annotate data-races around subflow
> ->fully_established"), but mostly reverted by caa4a79f74f3 ("mptcp:
> remove unneeded READ_ONCE() annotation").
>
> I don't know what's better here: either we leave it like that, and I can
> fix the size of the bit-field. Or we drop patch 1 and 2, and I resolve
> the small conflict on patch 3/5: commit 2b0f561f21b2 ("mptcp: avoid
> unneeded actions on subflow reset"). I can send a v2, and we can drop it
> if the other solution has been preferred.
Your v2 looks good, thanks for that, I'll go replace the patches with
those.
greg k-h
On 20/09/2026 15:10, Greg KH wrote:
> On Sun, Sep 20, 2026 at 11:33:47AM +0200, Matthieu Baerts wrote:
>> Hello,
>>
>> On 20/09/2026 09:48, sashiko-bot@kernel.org wrote:
>>> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>>> - [Low] mptcp: build failure due to READ_ONCE() on bit-field
>>
>> Mmh, I missed the fact this commit has already been backported in commit
>> 477aa7116a76 ("mptcp: annotate data-races around subflow
>> ->fully_established"), but mostly reverted by caa4a79f74f3 ("mptcp:
>> remove unneeded READ_ONCE() annotation").
>>
>> I don't know what's better here: either we leave it like that, and I can
>> fix the size of the bit-field. Or we drop patch 1 and 2, and I resolve
>> the small conflict on patch 3/5: commit 2b0f561f21b2 ("mptcp: avoid
>> unneeded actions on subflow reset"). I can send a v2, and we can drop it
>> if the other solution has been preferred.
>
> Your v2 looks good, thanks for that, I'll go replace the patches with
> those.
Thank you! And sorry for the extra work :)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
© 2016 - 2026 Red Hat, Inc.