mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] mptcp: Disconnect and selftest fixes
@ 2022-07-08 23:36 Mat Martineau
  2022-07-08 23:36 ` [PATCH net 1/2] mptcp: fix subflow traversal at disconnect time Mat Martineau
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mat Martineau @ 2022-07-08 23:36 UTC (permalink / raw)
  To: netdev
  Cc: Mat Martineau, davem, kuba, pabeni, edumazet, kishen.maloor,
	matthieu.baerts, mptcp

Patch 1 switches to a safe list iterator in the MPTCP disconnect code.

Patch 2 adds the userspace_pm.sh selftest script to the MPTCP selftest
Makefile, resolving the netdev/check_selftest CI failure.

Matthieu Baerts (1):
  selftests: mptcp: validate userspace PM tests by default

Paolo Abeni (1):
  mptcp: fix subflow traversal at disconnect time

 net/mptcp/protocol.c                       | 4 ++--
 tools/testing/selftests/net/mptcp/Makefile | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)


base-commit: 32b3ad1418ea53184ab7d652f13b5d66414d1bba
-- 
2.37.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] mptcp: fix subflow traversal at disconnect time
  2022-07-08 23:36 [PATCH net 0/2] mptcp: Disconnect and selftest fixes Mat Martineau
@ 2022-07-08 23:36 ` Mat Martineau
  2022-07-08 23:36 ` [PATCH net 2/2] selftests: mptcp: validate userspace PM tests by default Mat Martineau
  2022-07-11 11:00 ` [PATCH net 0/2] mptcp: Disconnect and selftest fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Mat Martineau @ 2022-07-08 23:36 UTC (permalink / raw)
  To: netdev
  Cc: Paolo Abeni, davem, kuba, edumazet, kishen.maloor,
	matthieu.baerts, mptcp, van fantasy, Mat Martineau

From: Paolo Abeni <pabeni@redhat.com>

At disconnect time the MPTCP protocol traverse the subflows
list closing each of them. In some circumstances - MPJ subflow,
passive MPTCP socket, the latter operation can remove the
subflow from the list, invalidating the current iterator.

Address the issue using the safe list traversing helper
variant.

Reported-by: van fantasy <g1042620637@gmail.com>
Fixes: b29fcfb54cd7 ("mptcp: full disconnect implementation")
Tested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 net/mptcp/protocol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index cc21fafd9726..21a3ed64226e 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2919,12 +2919,12 @@ static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk)
 
 static int mptcp_disconnect(struct sock *sk, int flags)
 {
-	struct mptcp_subflow_context *subflow;
+	struct mptcp_subflow_context *subflow, *tmp;
 	struct mptcp_sock *msk = mptcp_sk(sk);
 
 	inet_sk_state_store(sk, TCP_CLOSE);
 
-	mptcp_for_each_subflow(msk, subflow) {
+	list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
 		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
 
 		__mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_FASTCLOSE);
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] selftests: mptcp: validate userspace PM tests by default
  2022-07-08 23:36 [PATCH net 0/2] mptcp: Disconnect and selftest fixes Mat Martineau
  2022-07-08 23:36 ` [PATCH net 1/2] mptcp: fix subflow traversal at disconnect time Mat Martineau
@ 2022-07-08 23:36 ` Mat Martineau
  2022-07-11 11:00 ` [PATCH net 0/2] mptcp: Disconnect and selftest fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Mat Martineau @ 2022-07-08 23:36 UTC (permalink / raw)
  To: netdev
  Cc: Matthieu Baerts, davem, kuba, pabeni, edumazet, kishen.maloor,
	mptcp, Mat Martineau

From: Matthieu Baerts <matthieu.baerts@tessares.net>

The new script was not listed in the programs to test.

By consequence, some CIs running MPTCP selftests were not validating
these new tests. Note that MPTCP CI was validating it as it executes all
.sh scripts from 'tools/testing/selftests/net/mptcp' directory.

Fixes: 259a834fadda ("selftests: mptcp: functional tests for the userspace PM type")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 tools/testing/selftests/net/mptcp/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
index f905d5358e68..48a99e1453e1 100644
--- a/tools/testing/selftests/net/mptcp/Makefile
+++ b/tools/testing/selftests/net/mptcp/Makefile
@@ -6,7 +6,7 @@ KSFT_KHDR_INSTALL := 1
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
 
 TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \
-	      simult_flows.sh mptcp_sockopt.sh
+	      simult_flows.sh mptcp_sockopt.sh userspace_pm.sh
 
 TEST_GEN_FILES = mptcp_connect pm_nl_ctl mptcp_sockopt mptcp_inq
 
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] mptcp: Disconnect and selftest fixes
  2022-07-08 23:36 [PATCH net 0/2] mptcp: Disconnect and selftest fixes Mat Martineau
  2022-07-08 23:36 ` [PATCH net 1/2] mptcp: fix subflow traversal at disconnect time Mat Martineau
  2022-07-08 23:36 ` [PATCH net 2/2] selftests: mptcp: validate userspace PM tests by default Mat Martineau
@ 2022-07-11 11:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-11 11:00 UTC (permalink / raw)
  To: Mat Martineau
  Cc: netdev, davem, kuba, pabeni, edumazet, kishen.maloor,
	matthieu.baerts, mptcp

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri,  8 Jul 2022 16:36:08 -0700 you wrote:
> Patch 1 switches to a safe list iterator in the MPTCP disconnect code.
> 
> Patch 2 adds the userspace_pm.sh selftest script to the MPTCP selftest
> Makefile, resolving the netdev/check_selftest CI failure.
> 
> Matthieu Baerts (1):
>   selftests: mptcp: validate userspace PM tests by default
> 
> [...]

Here is the summary with links:
  - [net,1/2] mptcp: fix subflow traversal at disconnect time
    https://git.kernel.org/netdev/net/c/5c835bb142d4
  - [net,2/2] selftests: mptcp: validate userspace PM tests by default
    https://git.kernel.org/netdev/net/c/3ddabc433670

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-11 11:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 23:36 [PATCH net 0/2] mptcp: Disconnect and selftest fixes Mat Martineau
2022-07-08 23:36 ` [PATCH net 1/2] mptcp: fix subflow traversal at disconnect time Mat Martineau
2022-07-08 23:36 ` [PATCH net 2/2] selftests: mptcp: validate userspace PM tests by default Mat Martineau
2022-07-11 11:00 ` [PATCH net 0/2] mptcp: Disconnect and selftest fixes patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).