From: Martin KaFai Lau <martin.lau@linux.dev>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: kuba@kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org,
jhs@mojatatu.com, Keenan Dong <keenanat2000@gmail.com>,
Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH net] clsact: Fix use-after-free in init/destroy rollback asymmetry
Date: Fri, 13 Mar 2026 11:31:50 -0700 [thread overview]
Message-ID: <a370fae9-ffcd-4713-a2a8-1b9df5c51da9@linux.dev> (raw)
In-Reply-To: <20260313065531.98639-1-daniel@iogearbox.net>
On 3/12/26 11:55 PM, Daniel Borkmann wrote:
> Fix a use-after-free in the clsact qdisc upon init/destroy rollback asymmetry.
> The latter is achieved by first fully initializing a clsact instance, and
> then in a second step having a replacement failure for the new clsact qdisc
> instance. clsact_init() initializes ingress first and then takes care of the
> egress part. This can fail midway, for example, via tcf_block_get_ext(). Upon
> failure, the kernel will trigger the clsact_destroy() callback.
>
> Commit 1cb6f0bae504 ("bpf: Fix too early release of tcx_entry") details the
> way how the transition is happening. If tcf_block_get_ext on the q->ingress_block
> ends up failing, we took the tcx_miniq_inc reference count on the ingress
> side, but not yet on the egress side. clsact_destroy() tests whether the
> {ingress,egress}_entry was non-NULL. However, even in midway failure on the
> replacement, both are in fact non-NULL with a valid egress_entry from the
> previous clsact instance.
>
> What we really need to test for is whether the qdisc instance-specific ingress
> or egress side previously got initialized. This adds a small helper for checking
> the miniq initialization called mini_qdisc_pair_inited, and utilizes that upon
> clsact_destroy() in order to fix the use-after-free scenario. Convert the
> ingress_destroy() side as well so both are consistent to each other.
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
next prev parent reply other threads:[~2026-03-13 18:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 6:55 [PATCH net] clsact: Fix use-after-free in init/destroy rollback asymmetry Daniel Borkmann
2026-03-13 18:31 ` Martin KaFai Lau [this message]
2026-03-17 11:30 ` patchwork-bot+netdevbpf
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=a370fae9-ffcd-4713-a2a8-1b9df5c51da9@linux.dev \
--to=martin.lau@linux.dev \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jhs@mojatatu.com \
--cc=keenanat2000@gmail.com \
--cc=kuba@kernel.org \
--cc=martin.lau@kernel.org \
--cc=netdev@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