Commit 09b7e0f
committed
sch_hfsc: Fix qlen accounting bug when using peek in hfsc_enqueue()
jira VULN-68355
cve CVE-2025-38000
commit-author Cong Wang <xiyou.wangcong@gmail.com>
commit 3f98113
upstream-diff Minor conflict in hfsc_enqueue because we have already
backported ac9fe7d which changed !cl->cl_nactive
to cl_in_el_or_vttree(cl). No changes to the commit
content.
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: 12d0ad3 ("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>
(cherry picked from commit 3f98113)
Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>1 parent 3a4ffa4 commit 09b7e0f
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1584 | 1584 | | |
1585 | 1585 | | |
1586 | 1586 | | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
1587 | 1590 | | |
1588 | 1591 | | |
1589 | 1592 | | |
| |||
1599 | 1602 | | |
1600 | 1603 | | |
1601 | 1604 | | |
1602 | | - | |
1603 | | - | |
1604 | | - | |
1605 | 1605 | | |
1606 | 1606 | | |
1607 | 1607 | | |
| |||
0 commit comments