android_kernel_motorola_sm6375/net/sched
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Cong Wang 1034e33107 sch_hfsc: Fix qlen accounting bug when using peek in hfsc_enqueue()
[ Upstream commit 3f981138109f63232a5fb7165938d4c945cc1b9d ]

When enqueuing the first packet to an HFSC class, hfsc_enqueue() calls the
child qdisc's peek() operation before incrementing sch->q.qlen and
sch->qstats.backlog. If the child qdisc uses qdisc_peek_dequeued(), this may
trigger an immediate dequeue and potential packet drop. In such cases,
qdisc_tree_reduce_backlog() is called, but the HFSC qdisc's qlen and backlog
have not yet been updated, leading to inconsistent queue accounting. This
can leave an empty HFSC class in the active list, causing further
consequences like use-after-free.

This patch fixes the bug by moving the increment of sch->q.qlen and
sch->qstats.backlog before the call to the child qdisc's peek() operation.
This ensures that queue length and backlog are always accurate when packet
drops or dequeues are triggered during the peek.

Fixes: 12d0ad3be9 ("net/sched/sch_hfsc.c: handle corner cases where head may change invalidating calculated deadline")
Reported-by: Mingi Cho <mincho@theori.io>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250518222038.58538-2-xiyou.wangcong@gmail.com
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-04 14:32:35 +02:00
..
act_api.c net/sched: act_api: fix possible infinite loop in tcf_idr_check_alloc() 2024-07-05 09:08:23 +02:00
act_bpf.c
act_connmark.c
act_csum.c
act_ct.c
act_ctinfo.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:35:59 +02:00
act_mpls.c
act_nat.c
act_pedit.c net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX 2023-07-27 08:37:24 +02:00
act_police.c
act_sample.c
act_simple.c
act_skbedit.c
act_skbmod.c net/sched: act_skbmod: prevent kernel-infoleak 2024-04-13 12:51:34 +02:00
act_tunnel_key.c
act_vlan.c
cls_api.c net/sched: cls_api: Fix lockup on flushing explicitly created chain 2023-06-21 15:44:12 +02:00
cls_basic.c
cls_bpf.c
cls_cgroup.c
cls_flow.c net_sched: cls_flow: validate TCA_FLOW_RSHIFT attribute 2025-02-01 18:18:45 +01:00
cls_flower.c net: extract port range fields from fl_flow_key 2025-03-13 12:43:23 +01:00
cls_fw.c net/sched: cls_fw: No longer copy tcf_result on update to avoid use-after-free 2023-08-11 11:53:56 +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:53:56 +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:53:56 +02:00
em_canid.c
em_cmp.c
em_ipset.c
em_ipt.c
em_meta.c net: annotate lockless accesses to sk->sk_max_ack_backlog 2024-11-08 16:20:46 +01:00
em_nbyte.c
em_text.c net: sched: em_text: fix possible memory leak in em_text_destroy() 2024-01-15 18:25:25 +01:00
em_u32.c
ematch.c
Kconfig net/sched: Retire dsmark qdisc 2024-03-01 13:13:32 +01:00
Makefile net/sched: Retire dsmark qdisc 2024-03-01 13:13:32 +01:00
sch_api.c net_sched: Prevent creation of classes with TC_H_ROOT 2025-04-10 14:29:35 +02:00
sch_blackhole.c
sch_cake.c sched: sch_cake: add bounds checks to host bulk flow fairness counts 2025-03-13 12:43:04 +01:00
sch_cbs.c net/sched: cbs: Fix integer overflow in cbs_set_port_rate() 2024-12-14 19:44:51 +01:00
sch_choke.c net: sched: fix ordering of qlen adjustment 2025-01-09 13:23:26 +01:00
sch_codel.c
sch_drr.c net_sched: drr: Fix double list add in class with netem as child qdisc 2025-06-04 14:32:24 +02:00
sch_etf.c
sch_fifo.c pfifo_tail_enqueue: Drop new packet when sch->limit == 0 2025-03-13 12:43:25 +01:00
sch_fq.c
sch_fq_codel.c treewide: Remove uninitialized_var() usage 2023-06-09 10:29:01 +02:00
sch_generic.c net_sched: prevent NULL dereference if default qdisc setup failed 2023-04-20 12:07:34 +02:00
sch_gred.c
sch_hfsc.c sch_hfsc: Fix qlen accounting bug when using peek in hfsc_enqueue() 2025-06-04 14:32:35 +02:00
sch_hhf.c
sch_htb.c sch_htb: make htb_deactivate() idempotent 2025-06-04 14:32:26 +02:00
sch_ingress.c net/sched: Reserve TC_H_INGRESS (TC_H_CLSACT) for ingress (clsact) Qdiscs 2023-06-09 10:28:54 +02:00
sch_mq.c
sch_mqprio.c net/sched: mqprio: Add length check for TCA_MQPRIO_{MAX/MIN}_RATE64 2023-08-11 11:53:48 +02:00
sch_multiq.c net: sched: sch_multiq: fix possible OOB write in multiq_tune() 2024-07-05 09:08:11 +02:00
sch_netem.c netem: Update sch->q.qlen before qdisc_tree_reduce_backlog() 2025-03-13 12:43:06 +01:00
sch_pie.c
sch_plug.c net: sched: sch_qfq: Fix UAF in qfq_dequeue() 2023-09-23 10:59:59 +02:00
sch_prio.c
sch_qfq.c net_sched: qfq: Fix double list add in class with netem as child qdisc 2025-06-04 14:32:25 +02:00
sch_red.c
sch_sfb.c
sch_sfq.c treewide: Remove uninitialized_var() usage 2023-06-09 10:29:01 +02:00
sch_skbprio.c net_sched: skbprio: Remove overly strict queue assertions 2025-04-10 14:29:43 +02:00
sch_taprio.c net: sched: fix use-after-free in taprio_change() 2024-11-08 16:20:51 +01:00
sch_tbf.c net/sched: tbf: correct backlog statistic for GSO packets 2024-12-14 19:44:45 +01:00
sch_teql.c