mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time
@ 2022-07-06 11:18 Paolo Abeni
  2022-07-06 12:27 ` mptcp: fix subflow traveral at disconnect time: Tests Results MPTCP CI
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Paolo Abeni @ 2022-07-06 11:18 UTC (permalink / raw)
  To: mptcp

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")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
I think this should go soon upstream, sending here to trigger the CI

A pktdrill test will follow.
---
 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 10bfa2b78206..0264642f133f 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2881,12 +2881,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.35.3


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

* Re: mptcp: fix subflow traveral at disconnect time: Tests Results
  2022-07-06 11:18 [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Paolo Abeni
@ 2022-07-06 12:27 ` MPTCP CI
  2022-07-06 14:02 ` MPTCP CI
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: MPTCP CI @ 2022-07-06 12:27 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: mptcp

Hi Paolo,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- {"code":404,"message":
  - "Can't find artifacts containing file conclusion.txt"}:
  - Task: https://cirrus-ci.com/task/4674580001325056
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/4674580001325056/summary/summary.txt

- {"code":404,"message":
  - "Can't find artifacts containing file conclusion.txt"}:
  - Task: https://cirrus-ci.com/task/5055164154380288
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5055164154380288/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/d9e83c59b762


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

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

* Re: mptcp: fix subflow traveral at disconnect time: Tests Results
  2022-07-06 11:18 [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Paolo Abeni
  2022-07-06 12:27 ` mptcp: fix subflow traveral at disconnect time: Tests Results MPTCP CI
@ 2022-07-06 14:02 ` MPTCP CI
  2022-07-06 16:56 ` [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Matthieu Baerts
  2022-07-06 17:25 ` Matthieu Baerts
  3 siblings, 0 replies; 6+ messages in thread
From: MPTCP CI @ 2022-07-06 14:02 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: mptcp

Hi Paolo,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Unstable: 1 failed test(s): selftest_simult_flows 🔴:
  - Task: https://cirrus-ci.com/task/6553371904573440
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/6553371904573440/summary/summary.txt

- KVM Validation: debug:
  - Unstable: 1 failed test(s): packetdrill_add_addr 🔴:
  - Task: https://cirrus-ci.com/task/6525527967137792
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/6525527967137792/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/d9e83c59b762


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

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

* Re: [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time
  2022-07-06 11:18 [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Paolo Abeni
  2022-07-06 12:27 ` mptcp: fix subflow traveral at disconnect time: Tests Results MPTCP CI
  2022-07-06 14:02 ` MPTCP CI
@ 2022-07-06 16:56 ` Matthieu Baerts
  2022-07-06 17:15   ` Mat Martineau
  2022-07-06 17:25 ` Matthieu Baerts
  3 siblings, 1 reply; 6+ messages in thread
From: Matthieu Baerts @ 2022-07-06 16:56 UTC (permalink / raw)
  To: Paolo Abeni, Mat Martineau; +Cc: mptcp

Hi Paolo,

On 06/07/2022 13:18, Paolo Abeni wrote:
> 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")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> I think this should go soon upstream, sending here to trigger the CI
> 
> A pktdrill test will follow.

Because the CI report was not fully green, I ran the full tests suite on
my side (with and without a debug kernel) and I didn't spot any issues.

Tested-by: Matthieu Baerts <matthieu.baerts@tessares.net>

The patch looks good to me. If we can wait a bit, I guess it is better
to wait for Mat to review it. But I don't mind applying now if needed.


Also, I think we should probably add a new macro on net-next:

  mptcp_for_each_subflow_safe(msk, subflow, tmp)

WDYT?

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

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

* Re: [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time
  2022-07-06 16:56 ` [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Matthieu Baerts
@ 2022-07-06 17:15   ` Mat Martineau
  0 siblings, 0 replies; 6+ messages in thread
From: Mat Martineau @ 2022-07-06 17:15 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: Paolo Abeni, mptcp

On Wed, 6 Jul 2022, Matthieu Baerts wrote:

> Hi Paolo,
>
> On 06/07/2022 13:18, Paolo Abeni wrote:
>> 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")
>> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
>> ---
>> I think this should go soon upstream, sending here to trigger the CI
>>
>> A pktdrill test will follow.
>
> Because the CI report was not fully green, I ran the full tests suite on
> my side (with and without a debug kernel) and I didn't spot any issues.
>
> Tested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
>
> The patch looks good to me. If we can wait a bit, I guess it is better
> to wait for Mat to review it. But I don't mind applying now if needed.
>

Fine with me to apply it:

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

>
> Also, I think we should probably add a new macro on net-next:
>
>  mptcp_for_each_subflow_safe(msk, subflow, tmp)
>
> WDYT?

+1

--
Mat Martineau
Intel

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

* Re: [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time
  2022-07-06 11:18 [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Paolo Abeni
                   ` (2 preceding siblings ...)
  2022-07-06 16:56 ` [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Matthieu Baerts
@ 2022-07-06 17:25 ` Matthieu Baerts
  3 siblings, 0 replies; 6+ messages in thread
From: Matthieu Baerts @ 2022-07-06 17:25 UTC (permalink / raw)
  To: Paolo Abeni, mptcp

Hi Paolo, Mat,

On 06/07/2022 13:18, Paolo Abeni wrote:
> 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.

Thank you for the patch and the review!

Now in our tree (fix for -net) with Mat's RvB tag and without a typo in
the commit title spot by "checkpatch --codespell" (s/traveral/traversal)

New patches for t/upstream-net:
- 58ff490b91bb: mptcp: fix subflow traversal at disconnect time
- Results: baadb06447f4..521c161b5a7b (export-net)

New patches for t/upstream:
- 58ff490b91bb: mptcp: fix subflow traversal at disconnect time
- Results: bf96db80c6d5..16136c6f92f3 (export)


Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export-net/20220706T172158
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220706T172158

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

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

end of thread, other threads:[~2022-07-06 17:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 11:18 [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Paolo Abeni
2022-07-06 12:27 ` mptcp: fix subflow traveral at disconnect time: Tests Results MPTCP CI
2022-07-06 14:02 ` MPTCP CI
2022-07-06 16:56 ` [PATCH mptcp-net] mptcp: fix subflow traveral at disconnect time Matthieu Baerts
2022-07-06 17:15   ` Mat Martineau
2022-07-06 17:25 ` Matthieu Baerts

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).