Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Gao Feng and committed by
David S. Miller
7d3f0cd4 40501f90

+3
+3
include/net/sch_generic.h
··· 393 393 struct Qdisc_class_common *cl; 394 394 unsigned int h; 395 395 396 + if (!id) 397 + return NULL; 398 + 396 399 h = qdisc_class_hash(id, hash->hashmask); 397 400 hlist_for_each_entry(cl, &hash->hash[h], hnode) { 398 401 if (cl->classid == id)