From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>,
mptcp@lists.linux.dev, Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Cc: Geliang Tang <tanggeliang@kylinos.cn>, GangYan <gang.yan@linux.dev>
Subject: Re: [PATCH mptcp-net] mptcp: pm: userspace: fix use-after-free in get_local_id
Date: Tue, 21 Jul 2026 19:44:07 +0200 [thread overview]
Message-ID: <e4babe34-97a6-48aa-a564-a11da1136384@kernel.org> (raw)
In-Reply-To: <4e50adfde3b80f433e13b86919596be229045edc.1782799876.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 30/06/2026 08:11, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> In mptcp_pm_userspace_get_local_id(), the address entry is looked up under
> spinlock, but its id is read after dropping the lock. A concurrent deletion
> can free the entry between the unlock and the read, leading to UAF.
>
> Fix by copying the id into a local variable while still holding the lock,
> and use -1 as a "not found" sentinel.
Thank you for the fix, it looks good to me!
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
I hope that's OK, but I added Xuanqiang Luo's Tested-by tag, as he sent
almost the same patch recently (BTW, thank you Gang for spotting that):
https://lore.kernel.org/20260713074722.47921-1-xuanqiang.luo@linux.dev
While at it, I also added the KASAN report in the commit message, that's
helpful to prove this issue can happen and was tested.
New patches for t/upstream-net and t/upstream:
- 6b5c6ac1e2fe: mptcp: pm: userspace: fix use-after-free in get_local_id
- Results: 08c6392dbaf1..fef06e990c6c (export-net)
- Results: ea196b8ada26..f984839d1257 (export)
Tests are now in progress:
- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/05643696039e56609f35092206657c6cdb725baf/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/97ce11d2793f114ca652a565a8d2795c085d8ff1/checks
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
prev parent reply other threads:[~2026-07-21 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 6:11 [PATCH mptcp-net] mptcp: pm: userspace: fix use-after-free in get_local_id Geliang Tang
2026-06-30 7:13 ` MPTCP CI
2026-07-21 17:44 ` Matthieu Baerts [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=e4babe34-97a6-48aa-a564-a11da1136384@kernel.org \
--to=matttbe@kernel.org \
--cc=gang.yan@linux.dev \
--cc=geliang@kernel.org \
--cc=luoxuanqiang@kylinos.cn \
--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