]> git.ipfire.org Git - thirdparty/linux.git/commit
net/sched: reject overly deep qdisc hierarchies
authorZijie Huang <milkory@outlook.com>
Sat, 1 Aug 2026 13:42:33 +0000 (21:42 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 6 Aug 2026 13:24:44 +0000 (15:24 +0200)
commitdedd34b0f2310e28c5f6d4875cfbf4b7ed821c01
tree0ccba782af4a99ebde5b0742667f644666834607
parent7e2d693af0d4c05bddccb3541a0aabd69f4cb244
net/sched: reject overly deep qdisc hierarchies

Deep qdisc hierarchies can lead to excessive recursion in qdisc tree
walkers and exhaust the kernel stack. The existing loop check does not
cover the create-and-graft path, so a hierarchy can still be extended by
creating a new child qdisc below an already deep parent.

Store the hierarchy depth in struct Qdisc and update it when qdiscs are
grafted. Reject new child qdiscs once the parent is already at the maximum
allowed depth.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reported-by: Vega <vega@nebusec.ai>
Assisted-by: Codex:gpt-5.4
Signed-off-by: Zijie Huang <milkory@outlook.com>
Signed-off-by: Ren Wei <enjou1224z@gmail.com>
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Link: https://patch.msgid.link/1e9ab39597423fd5d13cfaaf52279b8ee3d9fc3c.1785434373.git.milkory@outlook.com
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/net/sch_generic.h
net/sched/sch_api.c