]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: Fix for duplicate class dump
authorPhil Sutter <phil@nwl.cc>
Thu, 18 Oct 2018 08:34:26 +0000 (10:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Oct 2018 23:00:02 +0000 (16:00 -0700)
commitc01bd45fb956f24f21886305ef03d0766fbc43d3
tree919d4fbb499bbca7812fa8fb1d4a37d544eb586b
parent6646776fa93ae280628f05861e8f9fe7b821e053
net: sched: Fix for duplicate class dump

When dumping classes by parent, kernel would return classes twice:

| # tc qdisc add dev lo root prio
| # tc class show dev lo
| class prio 8001:1 parent 8001:
| class prio 8001:2 parent 8001:
| class prio 8001:3 parent 8001:
| # tc class show dev lo parent 8001:
| class prio 8001:1 parent 8001:
| class prio 8001:2 parent 8001:
| class prio 8001:3 parent 8001:
| class prio 8001:1 parent 8001:
| class prio 8001:2 parent 8001:
| class prio 8001:3 parent 8001:

This comes from qdisc_match_from_root() potentially returning the root
qdisc itself if its handle matched. Though in that case, root's classes
were already dumped a few lines above.

Fixes: 3db3a7a785bb1 ("net: sched: optimize class dumps")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c