Commit bdfc87f7d1e253e0a61e2fc6a75ea9d76f7fc03a

Authored by Eric Dumazet
Committed by David S. Miller
1 parent b48d6f8bed

net-sched: sch_cbq: avoid infinite loop

Its possible to setup a bad cbq configuration leading to
an infinite loop in cbq_classify()

DEV_OUT=eth0
ICMP="match ip protocol 1 0xff"
U32="protocol ip u32"
DST="match ip dst"
tc qdisc add dev $DEV_OUT root handle 1: cbq avpkt 1000 \
	bandwidth 100mbit
tc class add dev $DEV_OUT parent 1: classid 1:1 cbq \
	rate 512kbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV_OUT parent 1: prio 3 $U32 \
	$ICMP $DST 192.168.3.234 flowid 1:

Reported-by: Denys Fedoryschenko <denys@visp.net.lb>
Tested-by: Denys Fedoryschenko <denys@visp.net.lb>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -250,10 +250,11 @@
250 250 else if ((cl = defmap[res.classid & TC_PRIO_MAX]) == NULL)
251 251 cl = defmap[TC_PRIO_BESTEFFORT];
252 252  
253   - if (cl == NULL || cl->level >= head->level)
  253 + if (cl == NULL)
254 254 goto fallback;
255 255 }
256   -
  256 + if (cl->level >= head->level)
  257 + goto fallback;
257 258 #ifdef CONFIG_NET_CLS_ACT
258 259 switch (result) {
259 260 case TC_ACT_QUEUED: