From: Davide Caratti <dcaratti@redhat.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
zdi-disclosures@trendmicro.com, security@kernel.org,
victor@mojatatu.com, jiri@resnulli.us
Subject: Re: [PATCH] net/sched: act_tunnel_key: Defer dst_release to RCU callback
Date: Mon, 13 Jul 2026 10:07:28 +0200 [thread overview]
Message-ID: <alScwJe_d_QXfBs_@dcaratti.users.ipa.redhat.com> (raw)
In-Reply-To: <20260711150537.7946-1-jhs@mojatatu.com>
On Sat, Jul 11, 2026 at 11:05:37AM -0400, Jamal Hadi Salim wrote:
> Fix a race-condition use-after-free in tunnel_key_release_params().
>
> The function releases the metadata_dst of the old params synchronously
> via dst_release() while deferring the params struct free with
> kfree_rcu(). A concurrent tunnel_key_act() reader on the datapath may
> still hold the old params pointer (under rcu_read_lock_bh) and proceed
> to call dst_clone(¶ms->tcft_enc_metadata->dst) after the writer's
> dst_release has already pushed the dst's rcuref to RCUREF_DEAD.
hello Jamal and Victor,
[...]
> Fix by moving dst_release() into a custom RCU callback that runs
> after the grace period, matching the lifetime of the containing
> params struct. Readers in the datapath therefore always find a live
> rcuref when calling dst_clone().
>
> Fixes: 9174c3df1cd18 ("net/sched: act_tunnel_key: fix memory leak in case of action replace")
> Reported-by: zdi-disclosures@trendmicro.com
> Tested-by: Victor Nogueira <victor@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> ---
> net/sched/act_tunnel_key.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
Thanks for this patch, LGTM!
Reviewed-by: Davide Caratti <dcaratti@redhat.com>
prev parent reply other threads:[~2026-07-13 8:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 15:05 [PATCH] net/sched: act_tunnel_key: Defer dst_release to RCU callback Jamal Hadi Salim
2026-07-13 8:07 ` Davide Caratti [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=alScwJe_d_QXfBs_@dcaratti.users.ipa.redhat.com \
--to=dcaratti@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=security@kernel.org \
--cc=victor@mojatatu.com \
--cc=zdi-disclosures@trendmicro.com \
/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