[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cab42321-cc54-4599-aaee-c631082f936c@mojatatu.com>
Date: Wed, 21 Jan 2026 16:43:16 -0300
From: Victor Nogueira <victor@...atatu.com>
To: Paul Moses <p@....org>, netdev@...r.kernel.org
Cc: Jamal Hadi Salim <jhs@...atatu.com>, Cong Wang
<xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH net v3 3/7] net/sched: act_gate: build schedule and
RCU-swap
On 21/01/2026 10:20, Paul Moses wrote:
> Build a fresh params snapshot and swap it in with rcu_replace_pointer(),
> then free the old snapshot via call_rcu(). This is the same publish+defer
> pattern used in taprio sched swapping (sch_taprio.c, commit d5c4546062fd6f)
> and in act_pedit param updates (act_pedit.c, commit 52cf89f78c01bf).
>
> When REPLACE omits TCA_GATE_ENTRY_LIST, carry forward the old snapshot fields
> (basetime/clockid/flags/cycletime/priority) and only override provided attrs,
> so partial updates don’t reset unrelated state.
>
> Parse entry lists with GFP_KERNEL and explicit error handling, matching taprio’s
> schedule parsing (sch_taprio.c, commit 5a781ccbd19e46).
> [...]
> @@ -388,32 +416,92 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
>
> gact = to_gate(*a);
>
> - err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
> - if (err < 0)
> + p = kzalloc(sizeof(*p), GFP_KERNEL);
> + if (!p) {
> + err = -ENOMEM;
> goto release_idr;
> + }
> + INIT_LIST_HEAD(&p->entries);
> [...]
> if (!cycletime) {
> @@ -425,20 +513,26 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
> cycletime = cycle;
> if (!cycletime) {
> err = -EINVAL;
> - goto chain_put;
> + goto release_mem;
> }
> }
> p->tcfg_cycletime = cycletime;
You are always using the just allocated params pointer (p) when iterating
through the entries [1]. So cycletime will always be 0 when the user
doesn't specify it. This is breaking tdc:
not ok 1119 3719 - Replace gate base-time action
# Command exited with 255, expected 0
# RTNETLINK answers: Invalid argument
# We have an error talking to the kernel
[1]
https://elixir.bootlin.com/linux/v6.18.6/source/net/sched/act_gate.c#L402
Powered by blists - more mailing lists