MPTCP Linux Development
 help / color / mirror / Atom feed
From: Akshit Patadiya <akshit@mpiricsoftware.com>
To: mptcp@lists.linux.dev
Cc: matttbe@kernel.org, martineau@kernel.org, pabeni@redhat.com,
	shardul.b@mpiricsoftware.com, janak@mpiric.us,
	kalpanjani009@gmail.com, kalpan.jani@mpiricsoftware.com
Subject: Re: [PATCH mptcp-next] mptcp: fix add_addr_accepted accounting on subflow close
Date: Tue, 15 Sep 2026 17:46:22 +0530	[thread overview]
Message-ID: <20260915121622.1151132-1-akshit@mpiricsoftware.com> (raw)
In-Reply-To: <20260813123754.4095492-1-akshit@mpiricsoftware.com>

Hi all,

Gentle ping on this patch. When you have a chance, could you please
take a look and let me know if there are any further changes needed?

On Thu, Aug 13, 2026 at 05:19:09PM +0530, sashiko-bot@kernel.org wrote:
> [High] Concurrent updates to msk->pm.rm_list_rx can cause RM_ADDR IDs
> to be silently skipped, resulting in leaked subflows.
>
> If a remote peer sends multiple RM_ADDR options in rapid succession,
> softirq context can call mptcp_pm_rm_addr_received(), which
> unconditionally overwrites pm->rm_list_rx while scheduling work

Looked into this, it's real. Traced it down:

mptcp_pm_rm_addr_recv() passes &msk->pm.rm_list_rx straight into
mptcp_pm_rm_addr_or_subflow() (pm.c:830), and that loop re-reads
rm_list->nr / rm_list->ids[i] on every iteration. It also drops
pm.lock mid-loop around mptcp_subflow_shutdown()/mptcp_close_ssk()
since those can't be called under a spinlock.

Worse, mptcp_pm_worker() clears the MPTCP_PM_RM_ADDR_RECEIVED bit
before calling mptcp_pm_rm_addr_recv():

	if (pm->status & BIT(MPTCP_PM_RM_ADDR_RECEIVED)) {
		pm->status &= ~BIT(MPTCP_PM_RM_ADDR_RECEIVED);
		mptcp_pm_rm_addr_recv(msk);
	}

so if a second RM_ADDR shows up while the first is still being
processed, mptcp_pm_schedule_work() sees the bit already clear,
treats it as new work, and mptcp_pm_rm_addr_received() overwrites
rm_list_rx right under the loop during one of its unlock windows
instead of getting coalesced. End result is the outer loop's i /
rm_list->nr can go stale mid-flight and some IDs from the original
batch just never get processed.

This is pre-existing, not something this patch touches (different
struct, different lock concern than the id_accepted_bitmap stuff
here), so I'm not folding a fix into this one. Will open a separate
issue/patch for it, can take it myself if nobody's already on it.

For #498 itself, this patch should close it as-is. It also looks
related to #496 per that issue's note - let me know if you want me
to check whether this covers that one too, or if it's a
prerequisite.

Tested against mptcp_join.sh for the close-before-RM_ADDR case,
fullmesh reuse of the same remote id, and duplicate RM_ADDR - all
passing.

Thanks and regards,
Akshit Patadiya 

  parent reply	other threads:[~2026-09-15 12:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 12:37 [PATCH mptcp-next] mptcp: fix add_addr_accepted accounting on subflow close Akshit Patadiya
2026-08-13 12:53 ` sashiko-bot
2026-08-13 13:52 ` MPTCP CI
2026-09-03  9:06 ` Akshit Patadiya
2026-09-15 12:16 ` Akshit Patadiya [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-15 12:11 Akshit Patadiya
2026-08-13 11:32 Akshit Patadiya
2026-08-13 11:49 ` sashiko-bot
2026-08-13 12:56 ` MPTCP CI

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=20260915121622.1151132-1-akshit@mpiricsoftware.com \
    --to=akshit@mpiricsoftware.com \
    --cc=janak@mpiric.us \
    --cc=kalpan.jani@mpiricsoftware.com \
    --cc=kalpanjani009@gmail.com \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=shardul.b@mpiricsoftware.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