Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
net: sched: Add the invalid handle check in qdisc_class_find
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gfreewind authored and davem330 committed Aug 21, 2017
1 parent 40501f9 commit 7d3f0cd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7d3f0cd

Please sign in to comment.