From bdba91ec70fb5ccbdeb1c7068319adc6ea9e1a7d Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 30 Jul 2007 17:07:14 -0700 Subject: [NET_SCHED]: Fix prio/ingress classification logic error Fix handling of empty or completely non-matching filter chains. In that case -1 is returned and tcf_result is uninitialized, the qdisc should fall back to default classification in that case. Noticed by PJ Waskiewicz . Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- net/sched/sch_prio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'net/sched/sch_prio.c') diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 2d8c08493d6e..71bafde353a6 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c @@ -38,9 +38,11 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) struct prio_sched_data *q = qdisc_priv(sch); u32 band = skb->priority; struct tcf_result res; + int err; *qerr = NET_XMIT_BYPASS; if (TC_H_MAJ(skb->priority) != sch->handle) { + err = tc_classify(skb, q->filter_list, &res); #ifdef CONFIG_NET_CLS_ACT switch (tc_classify(skb, q->filter_list, &res)) { case TC_ACT_STOLEN: @@ -49,11 +51,8 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) case TC_ACT_SHOT: return NULL; } - - if (!q->filter_list ) { -#else - if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) { #endif + if (!q->filter_list || err < 0) { if (TC_H_MAJ(band)) band = 0; band = q->prio2band[band&TC_PRIO_MAX]; -- cgit v1.2.1