From: sashiko-bot@kernel.org
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
"MPTCP Linux" <mptcp@lists.linux.dev>
Subject: Re: [PATCH mptcp-net] mptcp: disconnect: reset first subflow's local_id
Date: Thu, 15 Oct 2026 14:05:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-172945@kernel.org> (raw)
In-Reply-To: <20261015-mptcp-first-disco-id-reset-v1-1-6ae41e8f02c6@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] mptcp: NULL pointer dereference in mptcp_disconnect() on unconnected socket
--
commit 79fba9c250462a2f6852b46cf0562a508bcae604
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
mptcp: disconnect: reset first subflow's local_id
This commit resets the local_id of the first subflow to 0 when disconnecting.
This ensures the value is correctly initialized if the subflow is reused
after a reconnect.
Link: https://lore.kernel.org/179198834484.434549.4616694240552704738@kernel.org
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -3654,6 +3654,7 @@ static int mptcp_disconnect(struct sock *sk, int flags)
> */
> mptcp_do_fastclose(sk);
> mptcp_destroy_common(msk);
> + WRITE_ONCE(mptcp_subflow_ctx(msk->first)->local_id, 0);
[Severity: Critical]
Does this code cause a NULL pointer dereference in mptcp_disconnect() on an
unconnected socket?
If a user creates an MPTCP socket via socket(AF_MPTCP, SOCK_STREAM, 0),
msk->first is initially NULL. If the user then calls connect() with
AF_UNSPEC before any connection is made, the networking core handles
AF_UNSPEC by directly invoking the socket's disconnect handler,
mptcp_disconnect().
At this point, msk->first is still NULL. Passing it to mptcp_subflow_ctx()
yields an invalid pointer, leading to an immediate page fault when local_id
is written.
>
> /* The first subflow is already in TCP_CLOSE status, the following
> * can't overlap with a fallback anymore
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015-mptcp-first-disco-id-reset-v1-1-6ae41e8f02c6@kernel.org?part=1
next prev parent reply other threads:[~2026-10-15 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 13:54 [PATCH mptcp-net] mptcp: disconnect: reset first subflow's local_id Matthieu Baerts (NGI0)
2026-10-15 14:05 ` sashiko-bot [this message]
2026-10-15 15:26 ` Matthieu Baerts
2026-10-15 15:28 ` MPTCP CI
2026-10-16 16:47 ` 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=sashiko-outbox-172945@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@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