From 3a5bbc147dd9412e78283c51d2264a280323fd77 Mon Sep 17 00:00:00 2001 From: Jarek Poplawski Date: Mon, 9 Aug 2010 12:18:48 +0000 Subject: [PATCH] --- yaml --- r: 209201 b: refs/heads/master c: 68fd26b59856b466edd14d8a90d01255983cd3ee h: refs/heads/master i: 209199: a4b7865cac9134ca7fa0f0b67fadaed886da601e v: v3 --- [refs] | 2 +- trunk/net/sched/sch_api.c | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 4fee95a2b6b7..2ee2ab7b7c59 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: da7115d94a15f53efa224e47f16c57fd1998355f +refs/heads/master: 68fd26b59856b466edd14d8a90d01255983cd3ee diff --git a/trunk/net/sched/sch_api.c b/trunk/net/sched/sch_api.c index b9e8c3b7d406..8ed2f5649029 100644 --- a/trunk/net/sched/sch_api.c +++ b/trunk/net/sched/sch_api.c @@ -150,22 +150,34 @@ int register_qdisc(struct Qdisc_ops *qops) if (qops->enqueue == NULL) qops->enqueue = noop_qdisc_ops.enqueue; if (qops->peek == NULL) { - if (qops->dequeue == NULL) { + if (qops->dequeue == NULL) qops->peek = noop_qdisc_ops.peek; - } else { - rc = -EINVAL; - goto out; - } + else + goto out_einval; } if (qops->dequeue == NULL) qops->dequeue = noop_qdisc_ops.dequeue; + if (qops->cl_ops) { + const struct Qdisc_class_ops *cops = qops->cl_ops; + + if (!(cops->get && cops->put)) + goto out_einval; + + if (cops->tcf_chain && !(cops->bind_tcf && cops->unbind_tcf)) + goto out_einval; + } + qops->next = NULL; *qp = qops; rc = 0; out: write_unlock(&qdisc_mod_lock); return rc; + +out_einval: + rc = -EINVAL; + goto out; } EXPORT_SYMBOL(register_qdisc);