From: Paolo Abeni <pabeni@redhat.com>
To: Gang Yan <gang.yan@linux.dev>, mptcp@lists.linux.dev
Cc: Gang Yan <yangang@kylinos.cn>, Geliang Tang <geliang@kernel.org>
Subject: Re: [PATCH mptcp-net v5 4/5] mptcp: fix the dead_lock in mptcp_data_ready
Date: Wed, 1 Apr 2026 22:02:50 +0200 [thread overview]
Message-ID: <159f8b70-4ffa-4eef-a3ca-13de3f8bc191@redhat.com> (raw)
In-Reply-To: <8ed0aeb49f13410b25200d884c89ef3201d2c23b.1775033340.git.yangang@kylinos.cn>
On 4/1/26 10:54 AM, Gang Yan wrote:
> From: Gang Yan <yangang@kylinos.cn>
>
> This patch defers mptcp_check_data_fin from __mptcp_move_skbs to avoid
> deadlock.
>
> When processing backlogged data in softirq context, __mptcp_move_skbs
> directly calls mptcp_check_data_fin, which can lead to a deadlock if
> the msk socket is in TCP_FIN_WAIT2 state. In that case,
> mptcp_check_data_fin calls mptcp_shutdown_subflows, which attempts to
> lock the subflow socket with lock_sock_fast() - a sleeping function
> that cannot be called in atomic context (softirq).
The fix for such issue should be squashed inside the patch generating
the issue itself.
> The correct pattern is already used in move_skbs_to_msk: if a data fin
> is pending, schedule the work to be processed later in process context
> rather than handling it directly.
>
> Reported-by: Geliang Tang <geliang@kernel.org>
> Co-developed-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
> Notes:
>
> Hi Matt,Paolo:
>
> Here is the response of AI review for this patch:
>
> - Typo problem in subject line:
> Already fixed in v5.
>
> - Remove else branch:
> It demonstrates a TOCTOU race, though the race window is extremely
> narrow. The else branch is useless even without the race. So I
> removed it in v5. WDYT?
>
> Thanks,
> Gang
>
> Changelog:
> v5:
> - Fix typo in title.
> - Remove the else branch.
>
> ---
> net/mptcp/protocol.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 326b5d4d79e7..88e19fa61b84 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2247,8 +2247,9 @@ static bool __mptcp_move_skbs(struct sock *sk, struct list_head *skbs, u32 *delt
> }
>
> __mptcp_ofo_queue(msk);
> - if (moved)
> - mptcp_check_data_fin((struct sock *)msk);
> + if (moved && mptcp_pending_data_fin(sk, NULL))
> + mptcp_schedule_work(sk);
Scheduling the worker when we are not in BH could introduce problematic
delays. Instead you could factor out a ____mptcp_move_skbs() helper (a
better name would be nice!) not including the mptcp_check_data_fin()
call, use the latter in mptcp_data_ready() and in such function
eventually schedule the mptcp work as needed.
/P
next prev parent reply other threads:[~2026-04-01 20:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 8:54 [PATCH mptcp-net v5 0/5] mptcp: fix stall because of data_ready Gang Yan
2026-04-01 8:54 ` [PATCH mptcp-net v5 1/5] mptcp: replace backlog_list with backlog_queue Gang Yan
2026-04-01 20:12 ` Paolo Abeni
2026-04-15 7:17 ` Paolo Abeni
2026-04-15 8:21 ` gang.yan
2026-04-20 9:34 ` Paolo Abeni
2026-04-20 9:41 ` gang.yan
2026-04-20 10:33 ` Paolo Abeni
2026-04-21 1:26 ` gang.yan
2026-04-01 8:54 ` [PATCH mptcp-net v5 2/5] mptcp: fix the stall problems using backlog_queue Gang Yan
2026-04-01 8:54 ` [PATCH mptcp-net v5 3/5] mptcp: fix the stall problems with data_ready Gang Yan
2026-04-01 8:54 ` [PATCH mptcp-net v5 4/5] mptcp: fix the dead_lock in mptcp_data_ready Gang Yan
2026-04-01 20:02 ` Paolo Abeni [this message]
[not found] ` <e1f58d941ad141f9f96a24d1a1d9d6ca74cc2f5e@linux.dev>
2026-04-03 6:45 ` Fwd: " gang.yan
2026-04-13 15:49 ` Paolo Abeni
2026-04-01 8:54 ` [PATCH mptcp-net v5 5/5] selftests: mptcp: test transmission with small rcvbuf Gang Yan
2026-04-03 1:17 ` Geliang Tang
2026-04-03 8:52 ` Matthieu Baerts
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=159f8b70-4ffa-4eef-a3ca-13de3f8bc191@redhat.com \
--to=pabeni@redhat.com \
--cc=gang.yan@linux.dev \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=yangang@kylinos.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.