All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kyuwon.cho@skku.edu
Cc: matttbe@kernel.org, martineau@kernel.org, geliang@kernel.org,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, willemb@google.com, horms@kernel.org,
	kalpan.jani@mpiricsoftware.com, netdev@vger.kernel.org,
	mptcp@lists.linux.dev
Subject: Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0
Date: Sat, 05 Dec 2026 05:48:32 +0000	[thread overview]
Message-ID: <179644971271.3146.14330962742578426620@kernel.org> (raw)
In-Reply-To: <179633974213.577499.3953204420789445318@skku.edu>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The patch does not reliably fix the stale ID 0 ADD_ADDR entry
  and its WARN, and it breaks a removal form that used to work.

--

mptcp: pm: preserve the port when removing ID 0

This patch changes mptcp_nl_remove_id_zero_address() so the pending
ADD_ADDR lookup key uses the port from the removal request. Before, the
port was always forced to zero. The goal is to find and drop ID 0
announcements that were made with a port, which avoids a WARN in
mptcp_pm_announced_alloc() when the address is announced again.

> diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
> index f7396628490e3..99bc851408a45 100644
> --- a/net/mptcp/pm_kernel.c
> +++ b/net/mptcp/pm_kernel.c
> @@ -1151,7 +1151,7 @@ static int mptcp_nl_remove_id_zero_address(struct net *net,
>  		lock_sock(sk);
>  		/* Drop a possibly pending ADD_ADDR for this address. */
>  		anno_addr = msk_local;
> -		anno_addr.port = 0;
> +		anno_addr.port = addr->port;
>  		announced = mptcp_pm_announced_remove(msk, &anno_addr);

[Severity: High]
Doesn't this key still depend on how the removal request is written,
rather than on how the ID 0 entry was stored?

The ID 0 anno_list entry takes its port from the pernet endpoint behind
msk->mpc_endpoint_id. select_signal_address() copies entry->addr. Then
mptcp_pm_create_subflow_or_signal_addr() only rewrites the id to 0
before it calls mptcp_pm_announced_alloc().

mptcp_pm_announced_lookup() always compares ports:

	if (mptcp_addresses_equal(&entry->addr, addr, true))
		return entry;

The msk filter earlier in this function ignores the port when the
request has none:

	if (!mptcp_addresses_equal(&msk_local, addr, addr->port))
		goto next;

So the lookup only finds the entry if userspace repeats the endpoint's
exact port in the delete request.

Case 1: the ID 0 endpoint is "A port P signal". P has to equal
msk_local.port, as mptcp_nl_add_subflow_or_signal_addr() requires.

A portless "del id 0 A" passes the filter, builds the key {A, 0}, and
misses the {A, P} entry. The function still goes on to run:

	mptcp_pm_remove_addr(msk, &list);
	mptcp_pm_rm_subflow(msk, &list);
	__mark_subflow_endp_available(msk, 0);

The entry stays on anno_list and add_addr_signaled is not decremented.
When the next signal endpoint is added, select_signal_address() can pick
A:P again, and mptcp_pm_announced_alloc() hits:

	if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk)))
		return false;

Isn't that the same splat quoted in the commit message? The commit
message says "Portless removals continue to use zero", but that looks
like the case that still fails.

Case 2: the ID 0 endpoint is a portless "A signal". It is matched to
the msk's local address A:Q by address only. After it is announced
again, the entry is stored as {A, 0}.

A "del id 0 A port Q" request passes the filter, because Q equals
msk_local.port. It now builds the key {A, Q}, which misses {A, 0}.

Before this patch the port was forced to 0 and the entry was found.
Commit 2ac7d6e62076 relied on that behaviour. Is this a regression for
that form of the request? The commit message doesn't mention the change.

There may also be a side effect when a separate, non-ID 0 endpoint A:Q
and a portless ID 0 endpoint A exist on the same msk. Could the
port-qualified request remove the anno entry of endpoint A:Q instead?
That would decrement add_addr_signaled without a matching RM_ADDR for
that id. It isn't clear whether this state can be reached.

The non-zero ID path, mptcp_nl_remove_subflow_and_signal_addr(), uses
the stored endpoint's address and port for its lookup. Would it be more
robust to do the same here? Some options:

- match the anno_list entry on entry->addr.id == 0
- use the port of the pernet endpoint for msk->mpc_endpoint_id
- match on the address only, with use_port=false

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179633974213.577499.3953204420789445318%40skku.edu

      parent reply	other threads:[~2026-12-05  5:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  5:11 [PATCH net] mptcp: pm: preserve the port when removing ID 0 Kyuwon Cho
2026-12-04  6:38 ` MPTCP CI
2026-12-04 11:05 ` Matthieu Baerts
2026-12-05  1:47   ` Kyuwon Cho
2026-12-05  5:11 ` sashiko-bot
2026-12-05  5:48 ` netdev-bot+sashiko [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=179644971271.3146.14330962742578426620@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=geliang@kernel.org \
    --cc=horms@kernel.org \
    --cc=kalpan.jani@mpiricsoftware.com \
    --cc=kuba@kernel.org \
    --cc=kyuwon.cho@skku.edu \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.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 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.