pkt_sched: Check .walk and .leaf class handlers
authorJarek Poplawski <jarkao2@gmail.com>
Tue, 10 Aug 2010 22:31:20 +0000 (22:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Aug 2010 08:37:00 +0000 (01:37 -0700)
Require qdisc class ops .walk and .leaf for classful qdisc in
register_qdisc(). The checks could be done later insted, but these
ops are really needed and used by most of classful qdiscs.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c

index 8ed2f5649029f9086ee43a8cc6be26f9af36f650..408eea7086aace341d1ed9812d956db35cfdfb86 100644 (file)
@@ -161,7 +161,7 @@ int register_qdisc(struct Qdisc_ops *qops)
        if (qops->cl_ops) {
                const struct Qdisc_class_ops *cops = qops->cl_ops;
 
-               if (!(cops->get && cops->put))
+               if (!(cops->get && cops->put && cops->walk && cops->leaf))
                        goto out_einval;
 
                if (cops->tcf_chain && !(cops->bind_tcf && cops->unbind_tcf))