Skip to contentSkip to conversation

Old missing backports

PATCH Applied Matthieu Baerts (NGI0) 3 participants 19 messages Jul 31, 2025 – Aug 22, 2025

Subsystems (4)
lore
Share & tools
lore

Matthieu Baerts (NGI0)

author maintainer
#0 lore raw

cover Old missing backports

When working on an issue in the MPTCP selftests due to a recent backport, I noticed it was due to a missing backports. A few years ago, we were not properly monitoring the failed backports, and we missed a few patches:

- 857898eb4b28 ("selftests: mptcp: add missing join check")
- 0c1f78a49af7 ("mptcp: fix error mibs accounting")
- 31bf11de146c ("mptcp: introduce MAPPING_BAD_CSUM")
- fd37c2ecb21f ("selftests: mptcp: Initialize variables to quiet gcc 12 warnings")
- c886d70286bf ("mptcp: do not queue data on closed subflows")

An extra patch has been added to ease the other backports:

- b8e0def397d7 ("mptcp: drop unused sk in mptcp_push_release")

Geliang Tang (1):
mptcp: drop unused sk in mptcp_push_release

Mat Martineau (1):
selftests: mptcp: Initialize variables to quiet gcc 12 warnings

Matthieu Baerts (1):
selftests: mptcp: add missing join check

Paolo Abeni (3):
mptcp: fix error mibs accounting
mptcp: introduce MAPPING_BAD_CSUM
mptcp: do not queue data on closed subflows

 net/mptcp/options.c                           |  1 +
 net/mptcp/protocol.c                          | 17 ++++++++++------
 net/mptcp/protocol.h                          | 11 ++++++----
 net/mptcp/subflow.c                           | 20 +++++++++----------
 .../selftests/net/mptcp/mptcp_connect.c       |  2 +-
 .../testing/selftests/net/mptcp/mptcp_join.sh |  1 +
 6 files changed, 30 insertions(+), 22 deletions(-)
Signature · 1 line
2.50.0
author maintainer
#1 lore raw

PATCH 1/6 selftests: mptcp: add missing join check

From: Matthieu Baerts <[email protected]>

commit 857898eb4b28daf3faca3ae334c78b2bb141475e upstream.

This function also writes the name of the test with its ID, making clear a new test has been executed.

Without that, the ADD_ADDR results from this test was appended at the end of the previous test causing confusions. Especially when the second test was failing, we had:

17 signal invalid addresses syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] add[fail] got 2 ADD_ADDR[s] expected 3

In fact, this 17th test was OK but not the 18th one.

Now we have:

17 signal invalid addresses syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
18 signal addresses race test syn[fail] got 2 JOIN[s] syn expected 3
- synack[fail] got 2 JOIN[s] synack expected
- ack[fail] got 2 JOIN[s] ack expected 3
add[fail] got 2 ADD_ADDR[s] expected 3

Fixes 33c563ad28e3 ("selftests: mptcp: add_addr and echo race test")

[ Conflict in mptcp_join.sh, because commit 86e39e04482b ("mptcp: keep
track of local endpoint still available for each msk") is not in this version and changed the context. The same line can still be applied at the same place. ]

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
index 145749460bec..06634417e3c4 100755
@@ -1138,6 +1138,7 @@ signal_address_tests()
 	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags signal
 	ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags signal
 	run_tests $ns1 $ns2 10.0.1.1
+	chk_join_nr "signal addresses race test" 3 3 3
 	chk_add_nr 4 4
 }
 
Signature · 1 line
2.50.0
maintainer
#2 lore raw

Re: [PATCH 5.15.y 1/6] selftests: mptcp: add missing join check

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 857898eb4b28daf3faca3ae334c78b2bb141475e

WARNING: Author mismatch between patch and upstream commit:
Backport author: Matthieu Baerts (NGI0) <[email protected]> Commit author: Matthieu Baerts <[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---
1: 857898eb4b28 ! 1: 37fd6152bfd5 selftests: mptcp: add missing join check
@@ Metadata
## Commit message ##
selftests: mptcp: add missing join check

+ commit 857898eb4b28daf3faca3ae334c78b2bb141475e upstream.
+
This function also writes the name of the test with its ID, making clear a new test has been executed.

@@ Commit message

+ [ Conflict in mptcp_join.sh, because commit 86e39e04482b ("mptcp: keep
+ track of local endpoint still available for each msk") is not in this
+ version and changed the context. The same line can still be applied at
+ the same place. ]
+ Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>

## tools/testing/selftests/net/mptcp/mptcp_join.sh ##
@@ tools/testing/selftests/net/mptcp/mptcp_join.sh: signal_address_tests()
@@ tools/testing/selftests/net/mptcp/mptcp_join.sh: signal_address_tests()
ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags signal run_tests $ns1 $ns2 10.0.1.1
+ chk_join_nr "signal addresses race test" 3 3 3
+ chk_add_nr 4 4
+ }

- # the server will not signal the address terminating
- # the MPC subflow

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| 5.15                      | Success     | Success    |
maintainer Applied
#3 lore raw

Patch "selftests: mptcp: add missing join check" has been added to the 5.15-stable tree

In reply to Matthieu Baerts (NGI0)

This is a note to let you know that I've just added the patch titled

selftests: mptcp: add missing join check

to the 5.15-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:
selftests-mptcp-add-missing-join-check.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Thu Jul 31 13:24:22 2025
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Thu, 31 Jul 2025 13:23:55 +0200
Subject: selftests: mptcp: add missing join check
To: [email protected], [email protected], [email protected]
Cc: Matthieu Baerts <[email protected]>, [email protected], Paolo Abeni <[email protected]>, Mat Martineau <[email protected]>, Jakub Kicinski <[email protected]>, "Matthieu Baerts (NGI0)" <[email protected]>
Message-ID: <[email protected]>

From: Matthieu Baerts <[email protected]>

commit 857898eb4b28daf3faca3ae334c78b2bb141475e upstream.

This function also writes the name of the test with its ID, making clear a new test has been executed.

Without that, the ADD_ADDR results from this test was appended at the end of the previous test causing confusions. Especially when the second test was failing, we had:

17 signal invalid addresses syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] add[fail] got 2 ADD_ADDR[s] expected 3

In fact, this 17th test was OK but not the 18th one.

Now we have:

17 signal invalid addresses syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
18 signal addresses race test syn[fail] got 2 JOIN[s] syn expected 3
- synack[fail] got 2 JOIN[s] synack expected
- ack[fail] got 2 JOIN[s] ack expected 3
add[fail] got 2 ADD_ADDR[s] expected 3

Fixes 33c563ad28e3 ("selftests: mptcp: add_addr and echo race test")

[ Conflict in mptcp_join.sh, because commit 86e39e04482b ("mptcp: keep
track of local endpoint still available for each msk") is not in this version and changed the context. The same line can still be applied at the same place. ]

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh |    1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
@@ -1138,6 +1138,7 @@ signal_address_tests()
 	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags signal
 	ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags signal
 	run_tests $ns1 $ns2 10.0.1.1
+	chk_join_nr "signal addresses race test" 3 3 3
 	chk_add_nr 4 4
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-5.15/mptcp-drop-unused-sk-in-mptcp_push_release.patch queue-5.15/selftests-mptcp-connect-also-cover-alt-modes.patch queue-5.15/mptcp-drop-skb-if-mptcp-skb-extension-allocation-fails.patch queue-5.15/selftests-mptcp-connect-also-cover-checksum.patch queue-5.15/selftests-mptcp-make-sendfile-selftest-work.patch queue-5.15/selftests-mptcp-initialize-variables-to-quiet-gcc-12-warnings.patch queue-5.15/mptcp-pm-kernel-flush-do-not-reset-add_addr-limit.patch queue-5.15/mptcp-do-not-queue-data-on-closed-subflows.patch queue-5.15/selftests-mptcp-add-missing-join-check.patch queue-5.15/mptcp-fix-error-mibs-accounting.patch queue-5.15/mptcp-introduce-mapping_bad_csum.patch

author maintainer
#4 lore raw

PATCH 2/6 mptcp: fix error mibs accounting

In reply to Matthieu Baerts (NGI0)

From: Paolo Abeni <[email protected]>

commit 0c1f78a49af721490a5ad70b73e8b4d382465dae upstream.

The current accounting for MP_FAIL and FASTCLOSE is not very
accurate: both can be increased even when the related option is not really sent. Move the accounting into the correct place.

Fixes eb7f33654dc1 ("mptcp: add the mibs for MP_FAIL")
Fixes 1e75629cb964 ("mptcp: add the mibs for MP_FASTCLOSE")

[ Conflicts, because commit f284c0c77321 ("mptcp: implement fastclose
xmit path") is not in this version. That's OK, the new helper added by this commit doesn't need to be modified. ]

---
 net/mptcp/options.c | 1 +
 net/mptcp/subflow.c | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
net/mptcp/options.c +1 -0
index d1443c5732c8..501c818bf7dc 100644
@@ -793,6 +793,7 @@ static bool mptcp_established_options_mp_fail(struct sock *sk,
 	opts->fail_seq = subflow->map_seq;
 
 	pr_debug("MP_FAIL fail_seq=%llu\n", opts->fail_seq);
+	MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
 
 	return true;
 }
net/mptcp/subflow.c +1 -3
index 2bf7f65b0afe..6a7c48397e3d 100644
@@ -963,10 +963,8 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *
 				 subflow->map_data_csum);
 	if (unlikely(csum)) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
-		if (subflow->mp_join || subflow->valid_csum_seen) {
+		if (subflow->mp_join || subflow->valid_csum_seen)
 			subflow->send_mp_fail = 1;
-			MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX);
-		}
 		return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
 	}
 
Signature · 1 line
2.50.0
maintainer
#5 lore raw

Re: [PATCH 5.15.y 2/6] mptcp: fix error mibs accounting

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 0c1f78a49af721490a5ad70b73e8b4d382465dae

WARNING: Author mismatch between patch and upstream commit:
Backport author: Matthieu Baerts (NGI0) <[email protected]> Commit author: Paolo Abeni <[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---

1:  0c1f78a49af7 < -:  ------------ mptcp: fix error mibs accounting
-:  ------------ > 1:  b91cf40fe637 mptcp: fix error mibs accounting

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| 5.15                      | Success     | Success    |
maintainer Applied
#6 lore raw

Patch "mptcp: fix error mibs accounting" has been added to the 5.15-stable tree

In reply to Matthieu Baerts (NGI0)

This is a note to let you know that I've just added the patch titled

mptcp: fix error mibs accounting

to the 5.15-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-fix-error-mibs-accounting.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Thu Jul 31 13:24:24 2025
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Thu, 31 Jul 2025 13:23:56 +0200
Subject: mptcp: fix error mibs accounting
To: [email protected], [email protected], [email protected]
Cc: Paolo Abeni <[email protected]>, [email protected], Mat Martineau <[email protected]>, Jakub Kicinski <[email protected]>, "Matthieu Baerts (NGI0)" <[email protected]>
Message-ID: <[email protected]>

From: Paolo Abeni <[email protected]>

commit 0c1f78a49af721490a5ad70b73e8b4d382465dae upstream.

The current accounting for MP_FAIL and FASTCLOSE is not very
accurate: both can be increased even when the related option is not really sent. Move the accounting into the correct place.

Fixes eb7f33654dc1 ("mptcp: add the mibs for MP_FAIL")
Fixes 1e75629cb964 ("mptcp: add the mibs for MP_FASTCLOSE")

[ Conflicts, because commit f284c0c77321 ("mptcp: implement fastclose
xmit path") is not in this version. That's OK, the new helper added by this commit doesn't need to be modified. ]

---
 net/mptcp/options.c |    1 +
 net/mptcp/subflow.c |    4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
net/mptcp/options.c +1 -0
@@ -793,6 +793,7 @@ static bool mptcp_established_options_mp
 	opts->fail_seq = subflow->map_seq;
 
 	pr_debug("MP_FAIL fail_seq=%llu\n", opts->fail_seq);
+	MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
 
 	return true;
 }
net/mptcp/subflow.c +1 -3
@@ -963,10 +963,8 @@ static enum mapping_status validate_data
 				 subflow->map_data_csum);
 	if (unlikely(csum)) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
-		if (subflow->mp_join || subflow->valid_csum_seen) {
+		if (subflow->mp_join || subflow->valid_csum_seen)
 			subflow->send_mp_fail = 1;
-			MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX);
-		}
 		return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
 	}
 

Patches currently in stable-queue which might be from [email protected] are

queue-5.15/mptcp-drop-unused-sk-in-mptcp_push_release.patch queue-5.15/selftests-mptcp-connect-also-cover-alt-modes.patch queue-5.15/mptcp-drop-skb-if-mptcp-skb-extension-allocation-fails.patch queue-5.15/selftests-mptcp-connect-also-cover-checksum.patch queue-5.15/selftests-mptcp-make-sendfile-selftest-work.patch queue-5.15/selftests-mptcp-initialize-variables-to-quiet-gcc-12-warnings.patch queue-5.15/mptcp-pm-kernel-flush-do-not-reset-add_addr-limit.patch queue-5.15/mptcp-do-not-queue-data-on-closed-subflows.patch queue-5.15/selftests-mptcp-add-missing-join-check.patch queue-5.15/mptcp-fix-error-mibs-accounting.patch queue-5.15/mptcp-introduce-mapping_bad_csum.patch

author maintainer
#7 lore raw

PATCH 3/6 mptcp: introduce MAPPING_BAD_CSUM

In reply to Matthieu Baerts (NGI0)

From: Paolo Abeni <[email protected]>

commit 31bf11de146c3f8892093ff39f8f9b3069d6a852 upstream.

This allow moving a couple of conditional out of the fast path, making the code more easy to follow and will simplify the next patch.

Fixes ae66fb2ba6c3 ("mptcp: Do TCP fallback on early DSS checksum failure")

[ Conflicts in subflow.c, because commit 0348c690ed37 ("mptcp: add the
fallback check") is not in this version. This commit is linked to a new feature, changing the context around. The new condition can still be added at the same place. ]

---
 net/mptcp/subflow.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
net/mptcp/subflow.c +9 -9
index 6a7c48397e3d..6bc36132d490 100644
@@ -848,7 +848,8 @@ enum mapping_status {
 	MAPPING_INVALID,
 	MAPPING_EMPTY,
 	MAPPING_DATA_FIN,
-	MAPPING_DUMMY
+	MAPPING_DUMMY,
+	MAPPING_BAD_CSUM
 };
 
 static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn)
@@ -963,9 +964,7 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *
 				 subflow->map_data_csum);
 	if (unlikely(csum)) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
-		if (subflow->mp_join || subflow->valid_csum_seen)
-			subflow->send_mp_fail = 1;
-		return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
+		return MAPPING_BAD_CSUM;
 	}
 
 	subflow->valid_csum_seen = 1;
@@ -1188,10 +1187,8 @@ static bool subflow_check_data_avail(struct sock *ssk)
 
 		status = get_mapping_status(ssk, msk);
 		trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue));
-		if (unlikely(status == MAPPING_INVALID))
-			goto fallback;
-
-		if (unlikely(status == MAPPING_DUMMY))
+		if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY ||
+			     status == MAPPING_BAD_CSUM))
 			goto fallback;
 
 		if (status != MAPPING_OK)
@@ -1232,7 +1229,10 @@ static bool subflow_check_data_avail(struct sock *ssk)
 
 fallback:
 	/* RFC 8684 section 3.7. */
-	if (subflow->send_mp_fail) {
+	if (status == MAPPING_BAD_CSUM &&
+	    (subflow->mp_join || subflow->valid_csum_seen)) {
+		subflow->send_mp_fail = 1;
+
 		if (mptcp_has_another_subflow(ssk) ||
 		    !READ_ONCE(msk->allow_infinite_fallback)) {
 			while ((skb = skb_peek(&ssk->sk_receive_queue)))
Signature · 1 line
2.50.0
maintainer
#8 lore raw

Re: [PATCH 5.15.y 3/6] mptcp: introduce MAPPING_BAD_CSUM

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 31bf11de146c3f8892093ff39f8f9b3069d6a852

WARNING: Author mismatch between patch and upstream commit:
Backport author: Matthieu Baerts (NGI0) <[email protected]> Commit author: Paolo Abeni <[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)

Note: Could not generate a diff with upstream commit:
---
Note: Could not generate diff - patch failed to apply for comparison
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| 5.15                      | Success     | Success    |
maintainer Applied
#9 lore raw

Patch "mptcp: introduce MAPPING_BAD_CSUM" has been added to the 5.15-stable tree

In reply to Matthieu Baerts (NGI0)

This is a note to let you know that I've just added the patch titled

mptcp: introduce MAPPING_BAD_CSUM

to the 5.15-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-introduce-mapping_bad_csum.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Thu Jul 31 13:24:25 2025
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Thu, 31 Jul 2025 13:23:57 +0200
Subject: mptcp: introduce MAPPING_BAD_CSUM
To: [email protected], [email protected], [email protected]
Cc: Paolo Abeni <[email protected]>, [email protected], Mat Martineau <[email protected]>, Jakub Kicinski <[email protected]>, "Matthieu Baerts (NGI0)" <[email protected]>
Message-ID: <[email protected]>

From: Paolo Abeni <[email protected]>

commit 31bf11de146c3f8892093ff39f8f9b3069d6a852 upstream.

This allow moving a couple of conditional out of the fast path, making the code more easy to follow and will simplify the next patch.

Fixes ae66fb2ba6c3 ("mptcp: Do TCP fallback on early DSS checksum failure")

[ Conflicts in subflow.c, because commit 0348c690ed37 ("mptcp: add the
fallback check") is not in this version. This commit is linked to a new feature, changing the context around. The new condition can still be added at the same place. ]

---
 net/mptcp/subflow.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
net/mptcp/subflow.c +9 -9
@@ -848,7 +848,8 @@ enum mapping_status {
 	MAPPING_INVALID,
 	MAPPING_EMPTY,
 	MAPPING_DATA_FIN,
-	MAPPING_DUMMY
+	MAPPING_DUMMY,
+	MAPPING_BAD_CSUM
 };
 
 static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn)
@@ -963,9 +964,7 @@ static enum mapping_status validate_data
 				 subflow->map_data_csum);
 	if (unlikely(csum)) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
-		if (subflow->mp_join || subflow->valid_csum_seen)
-			subflow->send_mp_fail = 1;
-		return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
+		return MAPPING_BAD_CSUM;
 	}
 
 	subflow->valid_csum_seen = 1;
@@ -1188,10 +1187,8 @@ static bool subflow_check_data_avail(str
 
 		status = get_mapping_status(ssk, msk);
 		trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue));
-		if (unlikely(status == MAPPING_INVALID))
-			goto fallback;
-
-		if (unlikely(status == MAPPING_DUMMY))
+		if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY ||
+			     status == MAPPING_BAD_CSUM))
 			goto fallback;
 
 		if (status != MAPPING_OK)
@@ -1232,7 +1229,10 @@ no_data:
 
 fallback:
 	/* RFC 8684 section 3.7. */
-	if (subflow->send_mp_fail) {
+	if (status == MAPPING_BAD_CSUM &&
+	    (subflow->mp_join || subflow->valid_csum_seen)) {
+		subflow->send_mp_fail = 1;
+
 		if (mptcp_has_another_subflow(ssk) ||
 		    !READ_ONCE(msk->allow_infinite_fallback)) {
 			while ((skb = skb_peek(&ssk->sk_receive_queue)))

Patches currently in stable-queue which might be from [email protected] are

queue-5.15/mptcp-drop-unused-sk-in-mptcp_push_release.patch queue-5.15/selftests-mptcp-connect-also-cover-alt-modes.patch queue-5.15/mptcp-drop-skb-if-mptcp-skb-extension-allocation-fails.patch queue-5.15/selftests-mptcp-connect-also-cover-checksum.patch queue-5.15/selftests-mptcp-make-sendfile-selftest-work.patch queue-5.15/selftests-mptcp-initialize-variables-to-quiet-gcc-12-warnings.patch queue-5.15/mptcp-pm-kernel-flush-do-not-reset-add_addr-limit.patch queue-5.15/mptcp-do-not-queue-data-on-closed-subflows.patch queue-5.15/selftests-mptcp-add-missing-join-check.patch queue-5.15/mptcp-fix-error-mibs-accounting.patch queue-5.15/mptcp-introduce-mapping_bad_csum.patch

author maintainer
#10 lore raw

PATCH 4/6 selftests: mptcp: Initialize variables to quiet gcc 12 warnings

In reply to Matthieu Baerts (NGI0)

From: Mat Martineau <[email protected]>

commit fd37c2ecb21f7aee04ccca5f561469f07d00063c upstream.

In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable might be used uninitialized. This is a false positive because the only code path that could lead to uninitialized access is where getaddrinfo() fails, but the local xgetaddrinfo() wrapper exits if such a failure occurs.

Initialize the 'sock' variable anyway to allow the tools to build with gcc 12.

Fixes 048d19d444be ("mptcp: add basic kselftest for mptcp")

[ mptcp_inq.c and mptcp_sockopt.c are not in this version. The fix can
still be applied in mptcp_connect.c without conflicts. ]

---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +1 -1
index 95e81d557b08..599befcc1c4d 100644
@@ -188,7 +188,7 @@ static void set_mark(int fd, uint32_t mark)
 static int sock_listen_mptcp(const char * const listenaddr,
 			     const char * const port)
 {
-	int sock;
+	int sock = -1;
 	struct addrinfo hints = {
 		.ai_protocol = IPPROTO_TCP,
 		.ai_socktype = SOCK_STREAM,
Signature · 1 line
2.50.0
maintainer
#11 lore raw

Re: [PATCH 5.15.y 4/6] selftests: mptcp: Initialize variables to quiet gcc 12 warnings

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: fd37c2ecb21f7aee04ccca5f561469f07d00063c

WARNING: Author mismatch between patch and upstream commit:
Backport author: Matthieu Baerts (NGI0) <[email protected]> Commit author: Mat Martineau <[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---

1:  fd37c2ecb21f < -:  ------------ selftests: mptcp: Initialize variables to quiet gcc 12 warnings
-:  ------------ > 1:  95a487dc0102 selftests: mptcp: Initialize variables to quiet gcc 12 warnings

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| 5.15                      | Success     | Success    |
maintainer Applied
#12 lore raw

Patch "selftests: mptcp: Initialize variables to quiet gcc 12 warnings" has been added to the 5.15-stable tree

In reply to Matthieu Baerts (NGI0)

This is a note to let you know that I've just added the patch titled

selftests: mptcp: Initialize variables to quiet gcc 12 warnings

to the 5.15-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:
selftests-mptcp-initialize-variables-to-quiet-gcc-12-warnings.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Thu Jul 31 13:24:27 2025
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Thu, 31 Jul 2025 13:23:58 +0200
Subject: selftests: mptcp: Initialize variables to quiet gcc 12 warnings
To: [email protected], [email protected], [email protected]
Cc: Mat Martineau <[email protected]>, [email protected], Paolo Abeni <[email protected]>, Jakub Kicinski <[email protected]>, "Matthieu Baerts (NGI0)" <[email protected]>
Message-ID: <[email protected]>

From: Mat Martineau <[email protected]>

commit fd37c2ecb21f7aee04ccca5f561469f07d00063c upstream.

In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable might be used uninitialized. This is a false positive because the only code path that could lead to uninitialized access is where getaddrinfo() fails, but the local xgetaddrinfo() wrapper exits if such a failure occurs.

Initialize the 'sock' variable anyway to allow the tools to build with gcc 12.

Fixes 048d19d444be ("mptcp: add basic kselftest for mptcp")

[ mptcp_inq.c and mptcp_sockopt.c are not in this version. The fix can
still be applied in mptcp_connect.c without conflicts. ]

---
 tools/testing/selftests/net/mptcp/mptcp_connect.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +1 -1
@@ -188,7 +188,7 @@ static void set_mark(int fd, uint32_t ma
 static int sock_listen_mptcp(const char * const listenaddr,
 			     const char * const port)
 {
-	int sock;
+	int sock = -1;
 	struct addrinfo hints = {
 		.ai_protocol = IPPROTO_TCP,
 		.ai_socktype = SOCK_STREAM,

Patches currently in stable-queue which might be from [email protected] are

queue-5.15/mptcp-drop-unused-sk-in-mptcp_push_release.patch queue-5.15/selftests-mptcp-connect-also-cover-alt-modes.patch queue-5.15/mptcp-drop-skb-if-mptcp-skb-extension-allocation-fails.patch queue-5.15/selftests-mptcp-connect-also-cover-checksum.patch queue-5.15/selftests-mptcp-make-sendfile-selftest-work.patch queue-5.15/selftests-mptcp-initialize-variables-to-quiet-gcc-12-warnings.patch queue-5.15/mptcp-pm-kernel-flush-do-not-reset-add_addr-limit.patch queue-5.15/mptcp-do-not-queue-data-on-closed-subflows.patch queue-5.15/selftests-mptcp-add-missing-join-check.patch queue-5.15/mptcp-fix-error-mibs-accounting.patch queue-5.15/mptcp-introduce-mapping_bad_csum.patch

author maintainer
#13 lore raw

PATCH 5/6 mptcp: drop unused sk in mptcp_push_release

In reply to Matthieu Baerts (NGI0)

From: Geliang Tang <[email protected]>

commit b8e0def397d7753206b1290e32f73b299a59984c upstream.

Since mptcp_set_timeout() had removed from mptcp_push_release() in commit 33d41c9cd74c5 ("mptcp: more accurate timeout"), the argument sk in mptcp_push_release() became useless. Let's drop it.

Fixes 33d41c9cd74c5 ("mptcp: more accurate timeout")

Stable-dep-of: c886d70286bf ("mptcp: do not queue data on closed subflows")

---
 net/mptcp/protocol.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
net/mptcp/protocol.c +4 -5
index c6a11d6df516..6e9d1a749950 100644
@@ -1568,8 +1568,7 @@ static struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
 	return NULL;
 }
 
-static void mptcp_push_release(struct sock *sk, struct sock *ssk,
-			       struct mptcp_sendmsg_info *info)
+static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info)
 {
 	tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal);
 	release_sock(ssk);
@@ -1626,7 +1625,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 			 * the last round, release prev_ssk
 			 */
 			if (ssk != prev_ssk && prev_ssk)
-				mptcp_push_release(sk, prev_ssk, &info);
+				mptcp_push_release(prev_ssk, &info);
 			if (!ssk)
 				goto out;
 
@@ -1639,7 +1638,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 
 			ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
 			if (ret <= 0) {
-				mptcp_push_release(sk, ssk, &info);
+				mptcp_push_release(ssk, &info);
 				goto out;
 			}
 
@@ -1654,7 +1653,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 
 	/* at this point we held the socket lock for the last subflow we used */
 	if (ssk)
-		mptcp_push_release(sk, ssk, &info);
+		mptcp_push_release(ssk, &info);
 
 out:
 	/* ensure the rtx timer is running */
Signature · 1 line
2.50.0
maintainer
#14 lore raw

Re: [PATCH 5.15.y 5/6] mptcp: drop unused sk in mptcp_push_release

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: b8e0def397d7753206b1290e32f73b299a59984c

WARNING: Author mismatch between patch and upstream commit:
Backport author: Matthieu Baerts (NGI0) <[email protected]> Commit author: Geliang Tang <[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---
1: b8e0def397d7 ! 1: c702d329678d mptcp: drop unused sk in mptcp_push_release
@@ Metadata
## Commit message ##
mptcp: drop unused sk in mptcp_push_release

+ commit b8e0def397d7753206b1290e32f73b299a59984c upstream.
+
Since mptcp_set_timeout() had removed from mptcp_push_release() in commit 33d41c9cd74c5 ("mptcp: more accurate timeout"), the argument sk in mptcp_push_release() became useless. Let's drop it.
@@ Commit message

+ Stable-dep-of: c886d70286bf ("mptcp: do not queue data on closed subflows")
+ Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>

## net/mptcp/protocol.c ##
@@ net/mptcp/protocol.c: static struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| 5.15                      | Success     | Success    |
maintainer Applied
#15 lore raw

Patch "mptcp: drop unused sk in mptcp_push_release" has been added to the 5.15-stable tree

In reply to Matthieu Baerts (NGI0)

This is a note to let you know that I've just added the patch titled

mptcp: drop unused sk in mptcp_push_release

to the 5.15-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-drop-unused-sk-in-mptcp_push_release.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Thu Jul 31 13:24:29 2025
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Thu, 31 Jul 2025 13:23:59 +0200
Subject: mptcp: drop unused sk in mptcp_push_release
To: [email protected], [email protected], [email protected]
Cc: Geliang Tang <[email protected]>, [email protected], Matthieu Baerts <[email protected]>, Mat Martineau <[email protected]>, Jakub Kicinski <[email protected]>, "Matthieu Baerts (NGI0)" <[email protected]>
Message-ID: <[email protected]>

From: Geliang Tang <[email protected]>

commit b8e0def397d7753206b1290e32f73b299a59984c upstream.

Since mptcp_set_timeout() had removed from mptcp_push_release() in commit 33d41c9cd74c5 ("mptcp: more accurate timeout"), the argument sk in mptcp_push_release() became useless. Let's drop it.

Fixes 33d41c9cd74c5 ("mptcp: more accurate timeout")

Stable-dep-of: c886d70286bf ("mptcp: do not queue data on closed subflows")

---
 net/mptcp/protocol.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
net/mptcp/protocol.c +4 -5
@@ -1568,8 +1568,7 @@ static struct sock *mptcp_subflow_get_se
 	return NULL;
 }
 
-static void mptcp_push_release(struct sock *sk, struct sock *ssk,
-			       struct mptcp_sendmsg_info *info)
+static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info)
 {
 	tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal);
 	release_sock(ssk);
@@ -1626,7 +1625,7 @@ void __mptcp_push_pending(struct sock *s
 			 * the last round, release prev_ssk
 			 */
 			if (ssk != prev_ssk && prev_ssk)
-				mptcp_push_release(sk, prev_ssk, &info);
+				mptcp_push_release(prev_ssk, &info);
 			if (!ssk)
 				goto out;
 
@@ -1639,7 +1638,7 @@ void __mptcp_push_pending(struct sock *s
 
 			ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
 			if (ret <= 0) {
-				mptcp_push_release(sk, ssk, &info);
+				mptcp_push_release(ssk, &info);
 				goto out;
 			}
 
@@ -1654,7 +1653,7 @@ void __mptcp_push_pending(struct sock *s
 
 	/* at this point we held the socket lock for the last subflow we used */
 	if (ssk)
-		mptcp_push_release(sk, ssk, &info);
+		mptcp_push_release(ssk, &info);
 
 out:
 	/* ensure the rtx timer is running */

Patches currently in stable-queue which might be from [email protected] are

queue-5.15/mptcp-drop-unused-sk-in-mptcp_push_release.patch queue-5.15/selftests-mptcp-connect-also-cover-alt-modes.patch queue-5.15/mptcp-drop-skb-if-mptcp-skb-extension-allocation-fails.patch queue-5.15/selftests-mptcp-connect-also-cover-checksum.patch queue-5.15/selftests-mptcp-make-sendfile-selftest-work.patch queue-5.15/selftests-mptcp-initialize-variables-to-quiet-gcc-12-warnings.patch queue-5.15/mptcp-pm-kernel-flush-do-not-reset-add_addr-limit.patch queue-5.15/mptcp-do-not-queue-data-on-closed-subflows.patch queue-5.15/selftests-mptcp-add-missing-join-check.patch queue-5.15/mptcp-fix-error-mibs-accounting.patch queue-5.15/mptcp-introduce-mapping_bad_csum.patch

author maintainer
#16 lore raw

PATCH 6/6 mptcp: do not queue data on closed subflows

In reply to Matthieu Baerts (NGI0)

From: Paolo Abeni <[email protected]>

commit c886d70286bf3ad411eb3d689328a67f7102c6ae upstream.

Dipanjan reported a syzbot splat at close time:

WARNING: CPU: 1 PID: 10818 at net/ipv4/af_inet.c:153
inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153
Modules linked in: uio_ivshmem(OE) uio(E)
CPU: 1 PID: 10818 Comm: kworker/1:16 Tainted: G           OE
5.19.0-rc6-g2eae0556bb9d #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
Workqueue: events mptcp_worker
RIP: 0010:inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153
Code: 21 02 00 00 41 8b 9c 24 28 02 00 00 e9 07 ff ff ff e8 34 4d 91
f9 89 ee 4c 89 e7 e8 4a 47 60 ff e9 a6 fc ff ff e8 20 4d 91 f9 <0f> 0b
e9 84 fe ff ff e8 14 4d 91 f9 0f 0b e9 d4 fd ff ff e8 08 4d
RSP: 0018:ffffc9001b35fa78 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00000000002879d0 RCX: ffff8881326f3b00
RDX: 0000000000000000 RSI: ffff8881326f3b00 RDI: 0000000000000002
RBP: ffff888179662674 R08: ffffffff87e983a0 R09: 0000000000000000
R10: 0000000000000005 R11: 00000000000004ea R12: ffff888179662400
R13: ffff888179662428 R14: 0000000000000001 R15: ffff88817e38e258
FS:  0000000000000000(0000) GS:ffff8881f5f00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020007bc0 CR3: 0000000179592000 CR4: 0000000000150ee0
Call Trace:
 <TASK>
 __sk_destruct+0x4f/0x8e0 net/core/sock.c:2067
 sk_destruct+0xbd/0xe0 net/core/sock.c:2112
 __sk_free+0xef/0x3d0 net/core/sock.c:2123
 sk_free+0x78/0xa0 net/core/sock.c:2134
 sock_put include/net/sock.h:1927 [inline]
 __mptcp_close_ssk+0x50f/0x780 net/mptcp/protocol.c:2351
 __mptcp_destroy_sock+0x332/0x760 net/mptcp/protocol.c:2828
 mptcp_worker+0x5d2/0xc90 net/mptcp/protocol.c:2586
 process_one_work+0x9cc/0x1650 kernel/workqueue.c:2289
 worker_thread+0x623/0x1070 kernel/workqueue.c:2436
 kthread+0x2e9/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302
 </TASK>

The root cause of the problem is that an mptcp-level (re)transmit can race with mptcp_close() and the packet scheduler checks the subflow state before acquiring the socket lock: we can try to (re)transmit on an already closed ssk.

Fix the issue checking again the subflow socket status under the subflow socket lock protection. Additionally add the missing check for the fallback-to-tcp case.

Fixes d5f49190def6 ("mptcp: allow picking different xmit subflows")
---
 net/mptcp/protocol.c |  8 +++++++-
 net/mptcp/protocol.h | 11 +++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)
net/mptcp/protocol.c +7 -1
index 6e9d1a749950..bf2b9ba1c734 100644
@@ -1350,6 +1350,9 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 			 info->limit > dfrag->data_len))
 		return 0;
 
+	if (unlikely(!__tcp_can_send(ssk)))
+		return -EAGAIN;
+
 	/* compute send limit */
 	info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags);
 	copy = info->size_goal;
@@ -1512,7 +1515,8 @@ static struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
 	if (__mptcp_check_fallback(msk)) {
 		if (!msk->first)
 			return NULL;
-		return sk_stream_memory_free(msk->first) ? msk->first : NULL;
+		return __tcp_can_send(msk->first) &&
+		       sk_stream_memory_free(msk->first) ? msk->first : NULL;
 	}
 
 	/* re-use last subflow, if the burst allow that */
@@ -1638,6 +1642,8 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 
 			ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
 			if (ret <= 0) {
+				if (ret == -EAGAIN)
+					continue;
 				mptcp_push_release(ssk, &info);
 				goto out;
 			}
net/mptcp/protocol.h +7 -4
index cfb6aa72515e..8d05fb205a31 100644
@@ -599,16 +599,19 @@ void mptcp_info2sockaddr(const struct mptcp_addr_info *info,
 			 struct sockaddr_storage *addr,
 			 unsigned short family);
 
+static inline bool __tcp_can_send(const struct sock *ssk)
+{
+	/* only send if our side has not closed yet */
+	return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT));
+}
+
 static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow)
 {
-	struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
-
 	/* can't send if JOIN hasn't completed yet (i.e. is usable for mptcp) */
 	if (subflow->request_join && !subflow->fully_established)
 		return false;
 
-	/* only send if our side has not closed yet */
-	return ((1 << ssk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT));
+	return __tcp_can_send(mptcp_subflow_tcp_sock(subflow));
 }
 
 void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow);
Signature · 1 line
2.50.0
maintainer
#17 lore raw

Re: [PATCH 5.15.y 6/6] mptcp: do not queue data on closed subflows

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: c886d70286bf3ad411eb3d689328a67f7102c6ae

WARNING: Author mismatch between patch and upstream commit:
Backport author: Matthieu Baerts (NGI0) <[email protected]> Commit author: Paolo Abeni <[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)

Note: Could not generate a diff with upstream commit:
---
Note: Could not generate diff - patch failed to apply for comparison
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| 5.15                      | Success     | Success    |
maintainer Applied
#18 lore raw

Patch "mptcp: do not queue data on closed subflows" has been added to the 5.15-stable tree

In reply to Matthieu Baerts (NGI0)

This is a note to let you know that I've just added the patch titled

mptcp: do not queue data on closed subflows

to the 5.15-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-do-not-queue-data-on-closed-subflows.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Thu Jul 31 13:24:31 2025
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Thu, 31 Jul 2025 13:24:00 +0200
Subject: mptcp: do not queue data on closed subflows
To: [email protected], [email protected], [email protected]
Cc: Paolo Abeni <[email protected]>, [email protected], Dipanjan Das <[email protected]>, Mat Martineau <[email protected]>, "David S. Miller" <[email protected]>, "Matthieu Baerts (NGI0)" <[email protected]>
Message-ID: <[email protected]>

From: Paolo Abeni <[email protected]>

commit c886d70286bf3ad411eb3d689328a67f7102c6ae upstream.

Dipanjan reported a syzbot splat at close time:

WARNING: CPU: 1 PID: 10818 at net/ipv4/af_inet.c:153
inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153
Modules linked in: uio_ivshmem(OE) uio(E)
CPU: 1 PID: 10818 Comm: kworker/1:16 Tainted: G           OE
5.19.0-rc6-g2eae0556bb9d #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
Workqueue: events mptcp_worker
RIP: 0010:inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153
Code: 21 02 00 00 41 8b 9c 24 28 02 00 00 e9 07 ff ff ff e8 34 4d 91
f9 89 ee 4c 89 e7 e8 4a 47 60 ff e9 a6 fc ff ff e8 20 4d 91 f9 <0f> 0b
e9 84 fe ff ff e8 14 4d 91 f9 0f 0b e9 d4 fd ff ff e8 08 4d
RSP: 0018:ffffc9001b35fa78 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00000000002879d0 RCX: ffff8881326f3b00
RDX: 0000000000000000 RSI: ffff8881326f3b00 RDI: 0000000000000002
RBP: ffff888179662674 R08: ffffffff87e983a0 R09: 0000000000000000
R10: 0000000000000005 R11: 00000000000004ea R12: ffff888179662400
R13: ffff888179662428 R14: 0000000000000001 R15: ffff88817e38e258
FS:  0000000000000000(0000) GS:ffff8881f5f00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020007bc0 CR3: 0000000179592000 CR4: 0000000000150ee0
Call Trace:
 <TASK>
 __sk_destruct+0x4f/0x8e0 net/core/sock.c:2067
 sk_destruct+0xbd/0xe0 net/core/sock.c:2112
 __sk_free+0xef/0x3d0 net/core/sock.c:2123
 sk_free+0x78/0xa0 net/core/sock.c:2134
 sock_put include/net/sock.h:1927 [inline]
 __mptcp_close_ssk+0x50f/0x780 net/mptcp/protocol.c:2351
 __mptcp_destroy_sock+0x332/0x760 net/mptcp/protocol.c:2828
 mptcp_worker+0x5d2/0xc90 net/mptcp/protocol.c:2586
 process_one_work+0x9cc/0x1650 kernel/workqueue.c:2289
 worker_thread+0x623/0x1070 kernel/workqueue.c:2436
 kthread+0x2e9/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302
 </TASK>

The root cause of the problem is that an mptcp-level (re)transmit can race with mptcp_close() and the packet scheduler checks the subflow state before acquiring the socket lock: we can try to (re)transmit on an already closed ssk.

Fix the issue checking again the subflow socket status under the subflow socket lock protection. Additionally add the missing check for the fallback-to-tcp case.

---
 net/mptcp/protocol.c |    8 +++++++-
 net/mptcp/protocol.h |   11 +++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)
net/mptcp/protocol.c +7 -1
@@ -1350,6 +1350,9 @@ static int mptcp_sendmsg_frag(struct soc
 			 info->limit > dfrag->data_len))
 		return 0;
 
+	if (unlikely(!__tcp_can_send(ssk)))
+		return -EAGAIN;
+
 	/* compute send limit */
 	info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags);
 	copy = info->size_goal;
@@ -1512,7 +1515,8 @@ static struct sock *mptcp_subflow_get_se
 	if (__mptcp_check_fallback(msk)) {
 		if (!msk->first)
 			return NULL;
-		return sk_stream_memory_free(msk->first) ? msk->first : NULL;
+		return __tcp_can_send(msk->first) &&
+		       sk_stream_memory_free(msk->first) ? msk->first : NULL;
 	}
 
 	/* re-use last subflow, if the burst allow that */
@@ -1638,6 +1642,8 @@ void __mptcp_push_pending(struct sock *s
 
 			ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
 			if (ret <= 0) {
+				if (ret == -EAGAIN)
+					continue;
 				mptcp_push_release(ssk, &info);
 				goto out;
 			}
net/mptcp/protocol.h +7 -4
@@ -599,16 +599,19 @@ void mptcp_info2sockaddr(const struct mp
 			 struct sockaddr_storage *addr,
 			 unsigned short family);
 
-static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow)
+static inline bool __tcp_can_send(const struct sock *ssk)
 {
-	struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+	/* only send if our side has not closed yet */
+	return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT));
+}
 
+static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow)
+{
 	/* can't send if JOIN hasn't completed yet (i.e. is usable for mptcp) */
 	if (subflow->request_join && !subflow->fully_established)
 		return false;
 
-	/* only send if our side has not closed yet */
-	return ((1 << ssk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT));
+	return __tcp_can_send(mptcp_subflow_tcp_sock(subflow));
 }
 
 void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow);

Patches currently in stable-queue which might be from [email protected] are

queue-5.15/mptcp-drop-unused-sk-in-mptcp_push_release.patch queue-5.15/selftests-mptcp-connect-also-cover-alt-modes.patch queue-5.15/mptcp-drop-skb-if-mptcp-skb-extension-allocation-fails.patch queue-5.15/selftests-mptcp-connect-also-cover-checksum.patch queue-5.15/selftests-mptcp-make-sendfile-selftest-work.patch queue-5.15/selftests-mptcp-initialize-variables-to-quiet-gcc-12-warnings.patch queue-5.15/mptcp-pm-kernel-flush-do-not-reset-add_addr-limit.patch queue-5.15/mptcp-do-not-queue-data-on-closed-subflows.patch queue-5.15/selftests-mptcp-add-missing-join-check.patch queue-5.15/mptcp-fix-error-mibs-accounting.patch queue-5.15/mptcp-introduce-mapping_bad_csum.patch