summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc
diff options
context:
space:
mode:
authorJamal Hadi Salim <jhs@mojatatu.com>2026-10-13 04:54:30 -0400
committerJakub Kicinski <kuba@kernel.org>2026-10-20 12:55:51 -0700
commit2bc124a5f8df56aeabd444cded132407d91d9876 (patch)
treec2f3eb9b1d823a9a7cf96f6166c0e3e608ee2b80 /tools/lib/python/kdoc
parent150167ea4d7abdc3dba504abbbea699c9abeb425 (diff)
net/sched: sch_taprio: cap the number of schedule entries
parse_sched_list() accepts _any number_ of TCA_TAPRIO_SCHED_ENTRY elements. The only bound is the enclosing nlattr u16 nla_len. A minimal accepted entry is 12 bytes (the entry nest plus TCA_TAPRIO_SCHED_ENTRY_INTERVAL), so that u16 admits roughly 5460 entries - protocol-bounded amplification, not truly unbounded, but far past any hardware schedule. The bug: Each entry is a separate sched_entry allocation (368 bytes, rounded up to the kmalloc-512 bucket) and, in full offload, is also composed into a per-entry offload array, so the largest representable minimal list pins roughly 2.7 MiB for the lifetime of the schedule. Some context: The schedule list is not dumped the way the gate action list is: a taprio dump is bounded by the carrying skb (the 32K dump skb, and NLMSG_GOODSIZE for notify and unicast get), which keeps the plain nla_nest_end() closes from ever seeing a wrapped length. But the input-side amplification is the same class as the act_gate entry list, and the offload interface composes every supplied entry into the hardware schedule table without a capacity check. The top of the accepted band cannot be read back: a schedule above roughly 900 entries does not fit the 32K dump skb, so "tc qdisc show" fails loudly with -EMSGSIZE for it (as the action-dump patch does). The pre-existing silent gaps - no change notification above about 100 entries, and no unicast get reply - are tracked separately. The Cap: Cap the list at 1024 entries. This matches the SJA1105 schedule-table capacity (SJA1110 provides 4096) and the act_gate entry cap, and keeps the list inside the current 16-bit TLV format. This is an operational cap on a configuration the uAPI accepted before, so it is net-next hardening; a stable backport would start rejecting taprio configurations that install today. Conditions to recreate the bug: CAP_NET_ADMIN with CONFIG_NET_SCH_TAPRIO=y. Install a taprio qdisc with more than 1024 minimal TCA_TAPRIO_SCHED_ENTRY elements over a raw netlink RTM_NEWQDISC request. The cap rejects the list with -E2BIG and an extack naming the limit; 1024 entries install. Reviewed-by: Victor Nogueira <victor@mojatatu.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://patch.msgid.link/QDISC-H19Z.v3.r0.20261012193813-4@mojatatu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc')
0 files changed, 0 insertions, 0 deletions