Skip to content

Commit 066a3b5

Browse files
Jarek Poplawskidavem330
authored andcommitted
[NET_SCHED] sch_api: fix qdisc_tree_decrease_qlen() loop
TC_H_MAJ(parentid) for root classes is the same as for ingress, and if ingress qdisc is created qdisc_lookup() returns its pointer (without ingress NULL is returned). After this all qdisc_lookups give the same, and we get endless loop. (I don't know how this could hide for so long - it should trigger with every leaf class deleted if it's qdisc isn't empty.) After this fix qdisc_lookup() is omitted both for ingress and root parents, but looking for root is only wasting a little time here... Many thanks to Enrico Demarin for finding a test for catching this bug, which probably bothered quite a lot of admins. Reported-by: Enrico Demarin <[email protected]>, Signed-off-by: Jarek Poplawski <[email protected]> Acked-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 159d833 commit 066a3b5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/sched/sch_api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
386386
if (n == 0)
387387
return;
388388
while ((parentid = sch->parent)) {
389+
if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS))
390+
return;
391+
389392
sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
390393
if (sch == NULL) {
391394
WARN_ON(parentid != TC_H_ROOT);

0 commit comments

Comments
 (0)