[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <412136f7-1d46-42ac-96f9-b6cc462204b2@mojatatu.com>
Date: Wed, 21 Jan 2026 18:48:59 -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 6/7] net/sched: act_gate: reject empty schedule
list
On 21/01/2026 16:44, Victor Nogueira wrote:
> On 21/01/2026 10:20, Paul Moses wrote:
>> Reject empty schedules (num_entries == 0) so next_entry is always
>> valid and
>> RCU readers/timer logic never walk an empty list. taprio enforces the
>> same
>> constraint on schedules (sch_taprio.c, commit 09dbdf28f9f9fa).
>>
>> Fixes: a51c328df310 ("net: qos: introduce a gate control flow action")
>> Signed-off-by: Paul Moses <p@....org>
>> Cc: stable@...r.kernel.org
>> ---
>> net/sched/act_gate.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c
>> index 48ff378bb051a..e4134b9a4a314 100644
>> --- a/net/sched/act_gate.c
>> +++ b/net/sched/act_gate.c
>> @@ -509,6 +509,12 @@ static int tcf_gate_init(struct net *net, struct
>> nlattr *nla,
>> cycletime_ext = nla_get_u64(tb[TCA_GATE_CYCLE_TIME_EXT]);
>> p->tcfg_cycletime_ext = cycletime_ext;
>> + if (p->num_entries == 0) {
>> + NL_SET_ERR_MSG(extack, "The entry list is empty");
>> + err = -EINVAL;
>> + goto release_mem;
>> + }
>
> It would be simpler to check this in parse_gate_list.
> That way you could return -EINVAL there directly
> in case 0 entries were passed.
On second thought, I believe it would be better
to check whether parse_gate_list's return is 0
and the op is a create. Something like:
err = parse_gate_list(tb[TCA_GATE_ENTRY_LIST], p, extack);
...
if (!err && ret == ACT_P_CREATED) {
NL_SET_ERR_MSG(extack, "The entry list is empty");
err = -EINVAL;
goto release_mem;
}
so that you don't need to add new arguments to
parse_gate_list.
cheers,
Victor
Powered by blists - more mailing lists