MPTCP Linux Development
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: Mat Martineau <martineau@kernel.org>,
	Matthieu Baerts <matttbe@kernel.org>
Cc: mptcp@lists.linux.dev, Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next 0/3] only remove entry from local_addr_list when sending a REMOVE_ADDR
Date: Wed, 09 Apr 2025 15:02:08 +0800	[thread overview]
Message-ID: <4242d065ef94a08694cf76658e74b841eb9939ed.camel@kernel.org> (raw)
In-Reply-To: <a132ad93-029a-f083-d140-59929b4c4dc7@kernel.org>

Hi Mat,

On Tue, 2025-04-08 at 17:23 -0700, Mat Martineau wrote:
> On Wed, 2 Apr 2025, Geliang Tang wrote:
> 
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/403
> 
> Geliang and Matthieu -
> 
> Since this is a bug fix, should it go to mptcp-net rather than -next?
> Or 
> does the associated selftest change make that complicated?
> 
> I think there's a nearby bug in mptcp_pm_nl_remove_doit() that I
> noticed 
> while reviewing this series. If we upstream this series to the net
> tree it 
> might make sense to send the fixes together.
> 
> In this code:
> 
>  	list_del_rcu(&match->list);
>  	msk->pm.local_addr_used--;
>  	spin_unlock_bh(&msk->pm.lock);
> 
>  	mptcp_pm_remove_addr_entry(msk, match);
> 
>  	release_sock(sk);
> 
>  	sock_kfree_s(sk, match, sizeof(*match));
> 
> The struct is removed from a linked list with list_del_rcu(), but
> doesn't 
> wait for a grace period before the sock_kfree_s() in the final line.
> The 
> easy solution is to make the kfree rcu-aware and open-code the
> handling of 
> sk_omem_alloc, like this:
> 
>  	atomic_sub(sizeof(*match), &sk->sk_omem_alloc);
>  	kfree_rcu(match);

How about adding a new helper sock_kfree_rcu_s() here?

> 
> instead of calling sock_kfree_s(). tcp_md5_do_del() takes this
> approach. 
> This does allow possible allocation beyond the optmem limit, but only
> for 
> the duration of the rcu grace period.
> 
> I can send a patch tomorrow, unless someone wants to implement it
> before 

Great! Looking forward to your patch.

Thanks,
-Geliang

> then.
> 
> 
> - Mat
> 
> 
> > 
> > Geliang Tang (3):
> >  mptcp: pm: userspace: local_addr_used-- after sending REMOVE_ADDR
> >  mptcp: pm: userspace: drop delete_local_addr helper
> >  selftests: mptcp: send REMOVE_ADDR after subflow is deleted
> > 
> > net/mptcp/pm_userspace.c                      | 37 +++-------------
> > ---
> > .../testing/selftests/net/mptcp/mptcp_join.sh |  4 +-
> > .../selftests/net/mptcp/userspace_pm.sh       |  6 +++
> > 3 files changed, 14 insertions(+), 33 deletions(-)
> > 
> > -- 
> > 2.43.0
> > 
> > 
> > 


      reply	other threads:[~2025-04-09  7:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02  2:53 [PATCH mptcp-next 0/3] only remove entry from local_addr_list when sending a REMOVE_ADDR Geliang Tang
2025-04-02  2:53 ` [PATCH mptcp-next 1/3] mptcp: pm: userspace: local_addr_used-- after sending REMOVE_ADDR Geliang Tang
2025-04-08 23:51   ` Mat Martineau
2025-04-09  6:50     ` Geliang Tang
2025-04-02  2:53 ` [PATCH mptcp-next 2/3] mptcp: pm: userspace: drop delete_local_addr helper Geliang Tang
2025-04-02  2:53 ` [PATCH mptcp-next 3/3] selftests: mptcp: send REMOVE_ADDR after subflow is deleted Geliang Tang
2025-04-02  4:01 ` [PATCH mptcp-next 0/3] only remove entry from local_addr_list when sending a REMOVE_ADDR MPTCP CI
2025-04-09  0:23 ` Mat Martineau
2025-04-09  7:02   ` Geliang Tang [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=4242d065ef94a08694cf76658e74b841eb9939ed.camel@kernel.org \
    --to=geliang@kernel.org \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox