Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net_sched: hfsc: clear el_node linkage in hfsc_reset_class()
@ 2026-11-27  6:57 Henry Martin
  2026-11-27  7:03 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Henry Martin @ 2026-11-27  6:57 UTC (permalink / raw)
  To: Jamal Hadi Salim, Jiri Pirko, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Pedro Tammela
  Cc: netdev, Henry Martin, stable

hfsc_reset_qdisc() drops the eligible tree root, but hfsc_reset_class()
never resets the linkage state of cl->el_node.  A class that sits in the
eligible tree at reset time keeps a stale linked node while the tree is
gone.  This breaks the invariant that the linkage state of el_node
matches the membership, which hfsc_change_class() establishes for new
classes.

Two consumers trip over the stale node.  cl_in_el_or_vttree() reads it
as "class is in the tree", so hfsc_enqueue() never calls init_ed() for
the class again and the class is starved permanently.  eltree_remove()
later runs rb_erase() on the stale node against the reset root, which
splices a stale sibling back into q->eligible.rb_node and revives a
class the scheduler should have forgotten.

Clear the linkage state where the rest of the scheduling state is
reset.

This issue was discovered by Tencent CodeBuddy Security.

Cc: stable@vger.kernel.org
Fixes: ac9fe7dd8e73 ("net_sched: hfsc: Address reentrant enqueue adding class to eltree twice")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
 net/sched/sch_hfsc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 284490fd6ca91..e64df06429239 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1491,6 +1491,10 @@ hfsc_reset_class(struct hfsc_class *cl)
 
 	cl->vt_tree = RB_ROOT;
 	cl->cf_tree = RB_ROOT;
+	/* hfsc_reset_qdisc() drops the eligible tree root; the
+	 * linkage state of el_node must match the membership.
+	 */
+	RB_CLEAR_NODE(&cl->el_node);
 	qdisc_reset(cl->qdisc);
 
 	if (cl->cl_flags & HFSC_RSC)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-27  7:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  6:57 [PATCH net] net_sched: hfsc: clear el_node linkage in hfsc_reset_class() Henry Martin
2026-11-27  7:03 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox