Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/sched: Abort __tc_modify_qdisc if parent is a clsact/ingress qdisc

Wang reported an illegal configuration [1] where the user attempts to add a
child qdisc to the ingress qdisc as follows:

tc qdisc add dev eth0 handle ffff:0 ingress
tc qdisc add dev eth0 handle ffe0:0 parent ffff:a fq

To solve this, we reject any configuration attempt to add a child qdisc to
ingress or clsact.

[1] https://lore.kernel.org/netdev/20251105022213.1981982-1-wangliang74@huawei.com/

Fixes: 5e50da01d0ce ("[NET_SCHED]: Fix endless loops (part 2): "simple" qdiscs")
Reported-by: Wang Liang <wangliang74@huawei.com>
Closes: https://lore.kernel.org/netdev/20251105022213.1981982-1-wangliang74@huawei.com/
Reviewed-by: Pedro Tammela <pctammela@mojatatu.ai>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Reviewed-by: Cong Wang <cwang@multikernel.io>
Link: https://patch.msgid.link/20251106205621.3307639-1-victor@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Victor Nogueira and committed by
Jakub Kicinski
e781122d 1534ff77

+5
+5
net/sched/sch_api.c
··· 1599 1599 NL_SET_ERR_MSG(extack, "Failed to find specified qdisc"); 1600 1600 return -ENOENT; 1601 1601 } 1602 + if (p->flags & TCQ_F_INGRESS) { 1603 + NL_SET_ERR_MSG(extack, 1604 + "Cannot add children to ingress/clsact qdisc"); 1605 + return -EOPNOTSUPP; 1606 + } 1602 1607 q = qdisc_leaf(p, clid, extack); 1603 1608 if (IS_ERR(q)) 1604 1609 return PTR_ERR(q);