[PKT_SCHED]: netetm: trap infinite loop hange on qlen underflow
authorStephen Hemminger <shemminger@osdl.org>
Tue, 3 May 2005 23:24:03 +0000 (16:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 May 2005 23:24:03 +0000 (16:24 -0700)
Due to bugs in netem (fixed by later patches), it is possible to get qdisc
qlen to go negative. If this happens the CPU ends up spinning forever
in qdisc_run(). So add a BUG_ON() to trap it.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_generic.c

index 9a2f8e41a26ee9684fdea46adf684e9e88727ed9..87e48a4e105133ca3d0407b5c2d84f1b0e3a72c4 100644 (file)
@@ -179,6 +179,7 @@ requeue:
                netif_schedule(dev);
                return 1;
        }
+       BUG_ON((int) q->q.qlen < 0);
        return q->q.qlen;
 }