Skip to content

Commit fd090ba

Browse files
Phil Suttergregkh
authored andcommitted
net: sched: Fix for duplicate class dump
[ Upstream commit 3c53ed8 ] 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: cb395b2 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bc47870 commit fd090ba

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/sched/sch_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,8 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
19171917

19181918
if (tcm->tcm_parent) {
19191919
q = qdisc_match_from_root(root, TC_H_MAJ(tcm->tcm_parent));
1920-
if (q && tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
1920+
if (q && q != root &&
1921+
tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
19211922
return -1;
19221923
return 0;
19231924
}

0 commit comments

Comments
 (0)