From: Eric Dumazet <eric.dumazet at gmail.com>
To: mptcp at lists.01.org
Subject: [MPTCP] Re: [PATCH net 2/2] mptcp: better msk-level shutdown.
Date: Wed, 13 Jan 2021 11:21:00 +0100 [thread overview]
Message-ID: <a42a3c10-0183-a232-aec6-b1e6bbfaa800@gmail.com> (raw)
In-Reply-To: 4cd18371d7caa6ee4a4e7ef988b50b45e362e177.1610471474.git.pabeni@redhat.com
[-- Attachment #1: Type: text/plain, Size: 1709 bytes --]
On 1/12/21 6:25 PM, Paolo Abeni wrote:
> Instead of re-implementing most of inet_shutdown, re-use
> such helper, and implement the MPTCP-specific bits at the
> 'proto' level.
>
> The msk-level disconnect() can now be invoked, lets provide a
> suitable implementation.
>
> As a side effect, this fixes bad state management for listener
> sockets. The latter could lead to division by 0 oops since
> commit ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling").
>
> Fixes: 43b54c6ee382 ("mptcp: Use full MPTCP-level disconnect state machine")
> Fixes: ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling")
> Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
> ---
> net/mptcp/protocol.c | 62 ++++++++++++--------------------------------
> 1 file changed, 17 insertions(+), 45 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 2ff8c7caf74f..81faeff8f3bb 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2642,11 +2642,12 @@ static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk)
>
> static int mptcp_disconnect(struct sock *sk, int flags)
> {
> - /* Should never be called.
> - * inet_stream_connect() calls ->disconnect, but that
> - * refers to the subflow socket, not the mptcp one.
> - */
> - WARN_ON_ONCE(1);
> + struct mptcp_subflow_context *subflow;
> + struct mptcp_sock *msk = mptcp_sk(sk);
> +
> + __mptcp_flush_join_list(msk);
> + mptcp_for_each_subflow(msk, subflow)
> + tcp_disconnect(mptcp_subflow_tcp_sock(subflow), flags);
Ouch.
tcp_disconnect() is supposed to be called with socket lock being held.
Really, CONFIG_LOCKDEP=y should have warned you :/
next reply other threads:[~2021-01-13 10:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 10:21 Eric Dumazet [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-01-13 15:26 [MPTCP] Re: [PATCH net 2/2] mptcp: better msk-level shutdown Paolo Abeni
2021-01-13 10:26 Eric Dumazet
2021-01-12 21:38 Mat Martineau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a42a3c10-0183-a232-aec6-b1e6bbfaa800@gmail.com \
--to=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox