From: Gao Feng Date: Fri, 18 Aug 2017 07:23:24 +0000 (+0800) Subject: net: sched: Add the invalid handle check in qdisc_class_find X-Git-Tag: v4.14-rc1~130^2~180 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d3f0cd43feea1636dd7746f22fe8249b34d1b79;p=platform%2Fkernel%2Flinux-rpi.git net: sched: Add the invalid handle check in qdisc_class_find Add the invalid handle "0" check to avoid unnecessary search, because the qdisc uses the skb->priority as the handle value to look up, and it is "0" usually. Signed-off-by: Gao Feng Signed-off-by: David S. Miller --- diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 5865db9..107c524 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -393,6 +393,9 @@ qdisc_class_find(const struct Qdisc_class_hash *hash, u32 id) struct Qdisc_class_common *cl; unsigned int h; + if (!id) + return NULL; + h = qdisc_class_hash(id, hash->hashmask); hlist_for_each_entry(cl, &hash->hash[h], hnode) { if (cl->classid == id)