]> err.no Git - linux-2.6/commitdiff
[PKT_SCHED]: GRED: Report out-of-bound DPs as illegal
authorThomas Graf <tgraf@suug.ch>
Sat, 5 Nov 2005 20:14:14 +0000 (21:14 +0100)
committerThomas Graf <tgr@axs.localdomain>
Sat, 5 Nov 2005 21:02:26 +0000 (22:02 +0100)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/sched/sch_gred.c

index fdc20ced52ef3154b2fd6867b5d45f747ad2c653..b04b07fcc2cf15249e1c266066d5facbb424d780 100644 (file)
@@ -451,12 +451,9 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
                        return -EINVAL;
 
        ctl = RTA_DATA(tb[TCA_GRED_PARMS-1]);
-       if (ctl->DP > MAX_DPs-1 ) {
-               /* misbehaving is punished! Put in the default drop probability */
-               DPRINTK("\nGRED: DP %u not in  the proper range fixed. New DP "
-                       "set to default at %d\n",ctl->DP,table->def);
-               ctl->DP=table->def;
-       }
+
+       if (ctl->DP >= table->DPs)
+               return -EINVAL;
        
        if (table->tab[ctl->DP] == NULL) {
                table->tab[ctl->DP]=kmalloc(sizeof(struct gred_sched_data),