diff options
| author | Eric Dumazet <edumazet@google.com> | 2013-12-12 15:41:56 -0800 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-09-18 12:46:58 +0200 |
| commit | a8a52d73d88abc71d812bf24c530dd594af3bd1d (patch) | |
| tree | b8b0ef605143279c2d5b67df4d86ff0a2746c5fe | |
| parent | d02cc19197053cf677a34281c34a0ecac2cdd83a (diff) | |
pkt_sched: set root qdisc before change() in attach_default_qdiscs()
After commit 95dc19299f74 ("pkt_sched: give visibility to mq slave
qdiscs") we call disc_list_add() while the device qdisc might be
the noop_qdisc one.
This shows up as duplicates in "tc qdisc show", as all inactive devices
point to noop_qdisc.
Fix this by setting dev->qdisc to the new qdisc before calling
ops->change() in attach_default_qdiscs()
Add a WARN_ON_ONCE() to catch any future similar problem.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/sched/sch_api.c | 5 | ||||
| -rw-r--r-- | net/sched/sch_generic.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index e87b27c7b..4df817499 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -221,8 +221,11 @@ static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle) static void qdisc_list_add(struct Qdisc *q) { + struct Qdisc *root = qdisc_dev(q)->qdisc; + + WARN_ON_ONCE(root == &noop_qdisc); if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) - list_add_tail(&q->list, &qdisc_dev(q)->qdisc->list); + list_add_tail(&q->list, &root->list); } void qdisc_list_del(struct Qdisc *q) diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 1cdc95839..60676080c 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -747,8 +747,8 @@ static void attach_default_qdiscs(struct net_device *dev) } else { qdisc = qdisc_create_dflt(txq, &mq_qdisc_ops, TC_H_ROOT); if (qdisc) { - qdisc->ops->attach(qdisc); dev->qdisc = qdisc; + qdisc->ops->attach(qdisc); } } } |
