From: WANG Cong Date: Wed, 5 Apr 2017 01:51:30 +0000 (-0700) Subject: net_sched: check noop_qdisc before qdisc_hash_add() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=92f9170621a13e4ba4eda6dfb070318d5405a0cf;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git net_sched: check noop_qdisc before qdisc_hash_add() Dmitry reported a crash when injecting faults in attach_one_default_qdisc() and dev->qdisc is still a noop_disc, the check before qdisc_hash_add() fails to catch it because it tests NULL. We should test against noop_qdisc since it is the default qdisc at this point. Fixes: 59cc1f61f09c ("net: sched: convert qdisc linked list to hashtable") Reported-by: Dmitry Vyukov Cc: Jiri Kosina Signed-off-by: Cong Wang Acked-by: Jiri Kosina Signed-off-by: David S. Miller --- diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index b052b27a984e..1a2f9e964330 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -794,7 +794,7 @@ static void attach_default_qdiscs(struct net_device *dev) } } #ifdef CONFIG_NET_SCHED - if (dev->qdisc) + if (dev->qdisc != &noop_qdisc) qdisc_hash_add(dev->qdisc); #endif }