android_kernel_motorola_sm6225/net/sched
Pedro Tammela a39a303c06 net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve
commit a13b67c9a015c4e21601ef9aa4ec9c5d972df1b4 upstream.

Christian Theune says:
   I upgraded from 6.1.38 to 6.1.55 this morning and it broke my traffic shaping script,
   leaving me with a non-functional uplink on a remote router.

A 'rt' curve cannot be used as a inner curve (parent class), but we were
allowing such configurations since the qdisc was introduced. Such
configurations would trigger a UAF as Budimir explains:
   The parent will have vttree_insert() called on it in init_vf(),
   but will not have vttree_remove() called on it in update_vf()
   because it does not have the HFSC_FSC flag set.

The qdisc always assumes that inner classes have the HFSC_FSC flag set.
This is by design as it doesn't make sense 'qdisc wise' for an 'rt'
curve to be an inner curve.

Budimir's original patch disallows users to add classes with a 'rt'
parent, but this is too strict as it breaks users that have been using
'rt' as a inner class. Another approach, taken by this patch, is to
upgrade the inner 'rt' into a 'sc', warning the user in the process.
It avoids the UAF reported by Budimir while also being more permissive
to bad scripts/users/code using 'rt' as a inner class.

Users checking the `tc class ls [...]` or `tc class get [...]` dumps would
observe the curve change and are potentially breaking with this change.

v1->v2: https://lore.kernel.org/all/20231013151057.2611860-1-pctammela@mojatatu.com/
- Correct 'Fixes' tag and merge with revert (Jakub)

Cc: Christian Theune <ct@flyingcircus.io>
Cc: Budimir Markovic <markovicbudimir@gmail.com>
Fixes: b3d26c5702c7 ("net/sched: sch_hfsc: Ensure inner classes have fsc curve")
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20231017143602.3191556-1-pctammela@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25 11:16:48 +02:00
..
act_api.c net: sched: limit TC_ACT_REPEAT loops 2022-02-23 11:58:41 +01:00
act_bpf.c
act_connmark.c
act_csum.c
act_gact.c
act_ife.c
act_ipt.c
act_meta_mark.c
act_meta_skbprio.c
act_meta_skbtcindex.c
act_mirred.c net/sched: act_mirred: Add carrier check 2023-05-17 11:13:24 +02:00
act_nat.c
act_pedit.c net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX 2023-08-11 11:45:14 +02:00
act_police.c
act_sample.c
act_simple.c
act_skbedit.c
act_skbmod.c
act_tunnel_key.c
act_vlan.c
cls_api.c net: sched: fix possible refcount leak in tc_chain_tmplt_add() 2023-06-14 10:57:13 +02:00
cls_basic.c
cls_bpf.c
cls_cgroup.c
cls_flow.c treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
cls_flower.c net/sched: flower: fix possible OOB write in fl_set_geneve_opt() 2023-06-09 10:23:57 +02:00
cls_fw.c net/sched: cls_fw: No longer copy tcf_result on update to avoid use-after-free 2023-09-23 10:48:17 +02:00
cls_matchall.c
cls_route.c net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free 2023-08-11 11:45:37 +02:00
cls_u32.c net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free 2023-08-11 11:45:37 +02:00
em_canid.c
em_cmp.c
em_ipset.c
em_ipt.c
em_meta.c
em_nbyte.c
em_text.c
em_u32.c
ematch.c net_sched: reject TCF_EM_SIMPLE case for complex ematch module 2023-01-18 11:30:32 +01:00
Kconfig net/sched: Retire rsvp classifier 2023-09-23 10:48:18 +02:00
Makefile net/sched: Retire rsvp classifier 2023-09-23 10:48:18 +02:00
sch_api.c net/sched: fix a qdisc modification with ambiguous command request 2023-08-30 16:31:54 +02:00
sch_atm.c net: sched: atm: dont intepret cls results when asked to drop 2023-01-18 11:30:50 +01:00
sch_blackhole.c
sch_cake.c treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
sch_cbq.c treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
sch_cbs.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_choke.c
sch_codel.c
sch_drr.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_dsmark.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_etf.c
sch_fifo.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_fq.c
sch_fq_codel.c treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
sch_generic.c net: Fix data-races around weight_p and dev_weight_[rt]x_bias. 2022-09-05 10:26:30 +02:00
sch_gred.c
sch_hfsc.c net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve 2023-10-25 11:16:48 +02:00
sch_hhf.c
sch_htb.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_ingress.c net/sched: Reserve TC_H_INGRESS (TC_H_CLSACT) for ingress (clsact) Qdiscs 2023-06-09 10:23:56 +02:00
sch_mq.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_mqprio.c net/sched: mqprio: Add length check for TCA_MQPRIO_{MAX/MIN}_RATE64 2023-08-11 11:45:31 +02:00
sch_multiq.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_netem.c sch_netem: fix issues in netem_change() vs get_dist_table() 2023-08-16 18:13:01 +02:00
sch_pie.c
sch_plug.c net: sched: sch_qfq: Fix UAF in qfq_dequeue() 2023-09-23 10:48:13 +02:00
sch_prio.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_qfq.c net: sched: sch_qfq: Fix UAF in qfq_dequeue() 2023-09-23 10:48:13 +02:00
sch_red.c net: sched: Fix use after free in red_enqueue() 2022-11-10 17:46:52 +01:00
sch_sfb.c sch_sfb: Also store skb len before calling child enqueue 2022-09-15 12:17:06 +02:00
sch_sfq.c treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
sch_skbprio.c
sch_tbf.c net: sched: rename qdisc_destroy() to qdisc_put() 2021-12-14 10:18:04 +01:00
sch_teql.c