From: netdev-bot+sashiko@kernel.org
To: fadouse@pm.me
Cc: jhs@mojatatu.com, jiri@resnulli.us, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net v2] net/sched: act_ife: return -EAGAIN after dropping rtnl_lock in load_metaops_and_vet()
Date: Mon, 23 Nov 2026 12:48:54 +0000 [thread overview]
Message-ID: <179543813406.3135.15745616872300382040@kernel.org> (raw)
In-Reply-To: <20261122-b4-02-act-ife-rtnl-uaf-v2-102eba468698-v2-1-67c413c45928@pm.me>
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] This patch does not fully close the use-after-free it claims to
fix for cls_u32, one of the classifiers named in the commit message.
--
net/sched: act_ife: return -EAGAIN after dropping rtnl_lock in load_metaops_and_vet()
This patch changes load_metaops_and_vet() so that it returns -EAGAIN when
it has dropped rtnl_lock() to autoload an IFE metadata module and the
module then loads. The caller is then expected to replay the request under
a fresh RTNL critical section. The goal is to close a use-after-free in
RTNL-locked classifiers that hold unrefcounted pointers across
tcf_exts_validate().
> diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
> index 5a527da005661..5d6ca124e0047 100644
> --- a/net/sched/act_ife.c
> +++ b/net/sched/act_ife.c
> @@ -275,6 +275,14 @@ static int load_metaops_and_vet(u32 metaid, void *val, int len, bool rtnl_held)
> if (rtnl_held)
> rtnl_lock();
> ops = find_ife_oplist(metaid);
> + if (ops && rtnl_held) {
> + /* We dropped the RTNL mutex in order to perform the
> + * module load. Tell the caller to replay the request
> + * under a fresh RTNL critical section.
> + */
> + module_put(ops->owner);
> + return -EAGAIN;
> + }
> #endif
> }
[Severity: High]
Does this fully close the race for cls_u32? The commit message lists it as
one of the affected classifiers.
RTNL is still dropped around request_module(). The new -EAGAIN, and the
existing -ENOENT when the module does not load, both go back through the
classifier's error unwind before tc_new_tfilter() gets a chance to replay.
On the new-key path, u32_change() looks up a hash table pointer without
taking a reference. It then reserves a handle in that table and calls
u32_set_parms():
net/sched/cls_u32.c:u32_change() {
...
ht = u32_lookup_ht(tp->data, TC_U32_HTID(htid));
...
handle = gen_new_kid(ht, htid, &err);
...
err = u32_set_parms(net, tp, n, tb, tca[TCA_RATE],
flags, n->flags, extack);
...
}
u32_set_parms() reaches the RTNL drop like this:
u32_set_parms()
tcf_exts_validate_ex()
tcf_action_init()
tcf_ife_init()
load_metalist()
load_metaops_and_vet()
While RTNL is dropped, a concurrent RTM_DELTFILTER for that non-root hash
table can run u32_delete(). The pending knode is not linked yet and holds
no reference on ht, so the delete succeeds:
net/sched/cls_u32.c:u32_delete() {
...
if (refcount_dec_if_one(&ht->refcnt)) {
u32_destroy_hnode(tp, ht, extack);
...
}
u32_destroy_hnode() then calls idr_destroy(&ht->handle_idr) and
kfree_rcu(ht, rcu). request_module() sleeps while it waits for modprobe,
so a grace period can pass and ht can be freed.
When load_metaops_and_vet() then returns -EAGAIN, u32_change() unwinds to:
erridr:
idr_remove(&ht->handle_idr, handle);
return err;
Would this read and write the freed tc_u_hnode before tc_new_tfilter()
ever sees -EAGAIN?
The patch removes the success-path access to the freed table, which is the
ins = &ht->ht[TC_U32_HASH(handle)] lookup and the list insert. The stale
ht is still used on the error path, though.
tc_action_load_ops() also drops RTNL and returns -EAGAIN, so the same
unwind looks reachable through it too. Copying that pattern into act_ife
may therefore not be enough to protect cls_u32.
Could u32_change() hold a reference on ht across u32_set_parms() and drop
it on all exits? Alternatively, could this path avoid dropping RTNL at all?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122-b4-02-act-ife-rtnl-uaf-v2-102eba468698-v2-1-67c413c45928%40pm.me
next prev parent reply other threads:[~2026-11-23 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 12:45 [PATCH net v2] net/sched: act_ife: return -EAGAIN after dropping rtnl_lock in load_metaops_and_vet() YanXin Li via B4 Relay
2026-11-22 17:18 ` Stephen Hemminger
2026-11-23 12:48 ` netdev-bot+sashiko [this message]
2026-11-23 13:04 ` fadouse
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=179543813406.3135.15745616872300382040@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fadouse@pm.me \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/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