summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Heyne <mheyne@amazon.de>2021-03-04 14:43:17 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 16:43:43 +0100
commit7618f5e2f64fb15c3dc8ea980e79ece686b5d38c (patch)
tree1f7fc6973ddda2705ca94cc575749c93ad2abeb9
parent75756ebd0e0994de7d4386b4e014bf293e3c3a64 (diff)
downloadlinux-stable-7618f5e2f64fb15c3dc8ea980e79ece686b5d38c.tar.gz
linux-stable-7618f5e2f64fb15c3dc8ea980e79ece686b5d38c.tar.bz2
linux-stable-7618f5e2f64fb15c3dc8ea980e79ece686b5d38c.zip
net: sched: avoid duplicates in classes dump
commit bfc2560563586372212b0a8aeca7428975fa91fe upstream. This is a follow up of commit ea3274695353 ("net: sched: avoid duplicates in qdisc dump") which has fixed the issue only for the qdisc dump. The duplicate printing also occurs when dumping the classes via tc class show dev eth0 Fixes: 59cc1f61f09c ("net: sched: convert qdisc linked list to hashtable") Signed-off-by: Maximilian Heyne <mheyne@amazon.de> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/sched/sch_api.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index ed065c3432e5..1f12be9f0207 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -2048,7 +2048,7 @@ static int tc_dump_tclass_qdisc(struct Qdisc *q, struct sk_buff *skb,
static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
struct tcmsg *tcm, struct netlink_callback *cb,
- int *t_p, int s_t)
+ int *t_p, int s_t, bool recur)
{
struct Qdisc *q;
int b;
@@ -2059,7 +2059,7 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
if (tc_dump_tclass_qdisc(root, skb, tcm, cb, t_p, s_t) < 0)
return -1;
- if (!qdisc_dev(root))
+ if (!qdisc_dev(root) || !recur)
return 0;
if (tcm->tcm_parent) {
@@ -2094,13 +2094,13 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
s_t = cb->args[0];
t = 0;
- if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t) < 0)
+ if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t, true) < 0)
goto done;
dev_queue = dev_ingress_queue(dev);
if (dev_queue &&
tc_dump_tclass_root(dev_queue->qdisc_sleeping, skb, tcm, cb,
- &t, s_t) < 0)
+ &t, s_t, false) < 0)
goto done;
done: