summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGao Feng <gfree.wind@vip.163.com>2017-08-18 15:23:24 +0800
committerDavid S. Miller <davem@davemloft.net>2017-08-21 13:40:31 -0700
commit7d3f0cd43feea1636dd7746f22fe8249b34d1b79 (patch)
tree3b4187deb041d1d9667050bf1b64763fed79570f
parent40501f90ed5d992176ba504910d512d9dd1b2668 (diff)
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 <gfree.wind@vip.163.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sch_generic.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 5865db91976b..107c52432245 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)