From: Paolo Abeni <pabeni@redhat.com>
To: matttbe@kernel.org
Cc: martineau@kernel.org, geliang@kernel.org, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, horms@kernel.org,
netdev@vger.kernel.org, netdev-bot+sashiko@kernel.org,
mptcp@lists.linux.dev, stable@vger.kernel.org,
shardul.b@mpiricsoftware.com, xinyang@anthropic.com
Subject: Re: [PATCH net 2/2] mptcp: close race between scheduler and state change
Date: Thu, 17 Sep 2026 13:16:30 +0200 [thread overview]
Message-ID: <b32628f0-834d-4906-8479-7687887e371b@redhat.com> (raw)
In-Reply-To: <178959153630.22033.1222004531183755077@kernel.org>
On 9/16/26 22:45, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider:
>
> Critical: 0 · High: 1 · Medium: 0 · Low: 0
>
> - [High] Incomplete fix: the identical `mss_now == 0` divide-by-zero that
> the patch guards in `mptcp_push_release()` (net/mptcp/protocol.c:1667)…
>
> --
>
> mptcp: close race between scheduler and state change
>
> The patch guards the tcp_push() call in mptcp_push_release() with a check
> for info->mss_now being non-zero, so that a subflow which failed
> transmission (leaving mss_now at 0) is not used for a divide operation.
>
> Closes: https://lore.kernel.org/20260525194828.1137119-1-shardul.b@mpiricsoftware.com
>
>> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
>> index 0098e28309318..709610db3ce9d 100644
>> --- a/net/mptcp/protocol.c
>> +++ b/net/mptcp/protocol.c
>> @@ -1664,7 +1664,9 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
>>
>> 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);
>> + if (info->mss_now)
>> + tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle,
>> + info->size_goal);
>> release_sock(ssk);
>> }
>
> [Severity: High]
> Should the same guard also be added to the second tcp_push() call site, in
> __mptcp_subflow_push_pending()?
>
> That function starts with a zeroed info:
>
> net/mptcp/protocol.c:__mptcp_subflow_push_pending() {
> struct mptcp_sendmsg_info info = {
> .data_lock_held = true,
> };
> ...
> int copied = 0;
>
> and info.mss_now is only ever assigned inside mptcp_sendmsg_frag(), after
> the early return the commit message refers to:
>
> if (unlikely(!__tcp_can_send(ssk)))
> return -EAGAIN;
>
> /* compute send limit */
> ...
> info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags);
>
> In the non-first iteration, the return value is accumulated into copied
> without filtering negatives:
>
> net/mptcp/protocol.c:__mptcp_subflow_push_pending() {
> if (READ_ONCE(subflow->scheduled)) {
> mptcp_subflow_set_scheduled(subflow, false);
> ret = __subflow_push_pending(sk, ssk, &info);
> if (ret <= 0)
> keep_pushing = false;
> copied += ret;
> }
>
> __subflow_push_pending() passes mptcp_sendmsg_frag()'s -EAGAIN through
> verbatim when the first frag fails, so copied becomes -EAGAIN, which is
> non-zero, while info.mss_now is still 0:
This is a pre-existing issue but it could deserve to be fixed in the
same series.
/P
prev parent reply other threads:[~2026-09-17 11:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 20:37 [PATCH net 0/2] mptcp: misc fixes for v7.3-rc4 Matthieu Baerts (NGI0)
2026-09-15 20:37 ` [PATCH net 1/2] mptcp: avoid unneeded actions on subflow reset Matthieu Baerts (NGI0)
2026-09-16 20:45 ` netdev-bot+sashiko
2026-09-17 11:14 ` Paolo Abeni
2026-09-15 20:37 ` [PATCH net 2/2] mptcp: close race between scheduler and state change Matthieu Baerts (NGI0)
2026-09-16 20:45 ` netdev-bot+sashiko
2026-09-17 11:16 ` Paolo Abeni [this message]
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=b32628f0-834d-4906-8479-7687887e371b@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shardul.b@mpiricsoftware.com \
--cc=stable@vger.kernel.org \
--cc=xinyang@anthropic.com \
/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