From: sashiko-bot@kernel.org
To: "Gang Yan" <gang.yan@linux.dev>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v2 4/5] Squash to "mptcp: pm: init and release mptcp_pm_ops"
Date: Tue, 18 Aug 2026 10:03:45 +0000 [thread overview]
Message-ID: <20260818100345.8DA631F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818094825.48446-5-gang.yan@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Resource Leak on Error Path in `mptcp_net_init`
--
--- Patch [4]: [PATCH mptcp-next v2 4/5] Squash to "mptcp: pm: init and release mptcp_pm_ops" ---
commit b8f493287a2fef63b437fe19fc22666b77c1c08b
Author: Gang Yan <yangang@kylinos.cn>
Squash to "mptcp: pm: init and release mptcp_pm_ops"
This commit introduces lifetime handling for mptcp_pm_ops at the pernet
level. It pins the default mptcp_pm_kernel by taking a module reference
during pernet defaults initialization and releases it during network
namespace exit.
> diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
> index 733706f06f1b1..32268aa260976 100644
> --- a/net/mptcp/ctrl.c
> +++ b/net/mptcp/ctrl.c
> @@ -124,7 +124,9 @@ static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
> pernet->pm_type = MPTCP_PM_TYPE_KERNEL;
>
> RCU_INIT_POINTER(pernet->scheduler, &mptcp_sched_default);
> - RCU_INIT_POINTER(pernet->path_manager, &mptcp_pm_kernel);
> +
> + if (bpf_try_module_get(&mptcp_pm_kernel, mptcp_pm_kernel.owner))
> + RCU_INIT_POINTER(pernet->path_manager, &mptcp_pm_kernel);
[Severity: Medium]
Does this introduce a module reference leak regression on the error path
during network namespace initialization?
When mptcp_pernet_set_defaults() takes this module reference, it is called
from mptcp_net_init() right before mptcp_pernet_new_table():
mptcp_net_init() {
mptcp_pernet_set_defaults(pernet);
return mptcp_pernet_new_table(net, pernet);
}
If mptcp_pernet_new_table() fails and returns an error, the error is
propagated without releasing the module reference acquired here. Because the
initialization failed, the core network namespace code will not call the
corresponding exit function mptcp_net_exit() to release it.
Should mptcp_net_init() clean up the reference if mptcp_pernet_new_table()
fails?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260818094825.48446-1-gang.yan@linux.dev?part=4
next prev parent reply other threads:[~2026-08-18 10:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 9:48 [PATCH mptcp-next v2 0/5] mptcp: avoid data-races around the sysctls Gang Yan
2026-08-18 9:48 ` [PATCH mptcp-next v2 1/5] mptcp: sched: change scheduler sysctl atomically Gang Yan
2026-08-18 9:59 ` sashiko-bot
2026-08-18 12:56 ` gang.yan
2026-08-18 15:50 ` Matthieu Baerts
2026-08-18 9:48 ` [PATCH mptcp-next v2 2/5] mptcp: pm: change path_manager " Gang Yan
2026-08-18 10:00 ` sashiko-bot
2026-08-18 12:57 ` gang.yan
2026-08-18 15:52 ` Matthieu Baerts
2026-08-18 9:48 ` [PATCH mptcp-next v2 3/5] mptcp: use READ_ONCE() over sysctls Gang Yan
2026-08-18 10:01 ` sashiko-bot
2026-08-18 13:02 ` gang.yan
2026-08-18 15:57 ` Matthieu Baerts
2026-08-18 9:48 ` [PATCH mptcp-next v2 4/5] Squash to "mptcp: pm: init and release mptcp_pm_ops" Gang Yan
2026-08-18 10:03 ` sashiko-bot [this message]
2026-08-18 13:06 ` gang.yan
2026-08-18 9:48 ` [PATCH mptcp-next v2 5/5] Squash to "bpf: Add mptcp packet scheduler struct_ops" Gang Yan
2026-08-18 11:13 ` [PATCH mptcp-next v2 0/5] mptcp: avoid data-races around the sysctls 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=20260818100345.8DA631F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gang.yan@linux.dev \
--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 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.