aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_gred.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-11-05 15:14:14 -0500
committerThomas Graf <tgr@axs.localdomain>2005-11-05 16:02:26 -0500
commita8aaa9958eea2420e13d5a00c3fae934e0a3889e (patch)
tree1e85c385c7ce81afdf8bb7203df1ce56cd404892 /net/sched/sch_gred.c
parent6639607ed9deaed9ab3a1cc588f0288891ece2ac (diff)
[PKT_SCHED]: GRED: Report out-of-bound DPs as illegal
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/sched/sch_gred.c')
-rw-r--r--net/sched/sch_gred.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index fdc20ced52ef..b04b07fcc2cf 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -451,12 +451,9 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
451 return -EINVAL; 451 return -EINVAL;
452 452
453 ctl = RTA_DATA(tb[TCA_GRED_PARMS-1]); 453 ctl = RTA_DATA(tb[TCA_GRED_PARMS-1]);
454 if (ctl->DP > MAX_DPs-1 ) { 454
455 /* misbehaving is punished! Put in the default drop probability */ 455 if (ctl->DP >= table->DPs)
456 DPRINTK("\nGRED: DP %u not in the proper range fixed. New DP " 456 return -EINVAL;
457 "set to default at %d\n",ctl->DP,table->def);
458 ctl->DP=table->def;
459 }
460 457
461 if (table->tab[ctl->DP] == NULL) { 458 if (table->tab[ctl->DP] == NULL) {
462 table->tab[ctl->DP]=kmalloc(sizeof(struct gred_sched_data), 459 table->tab[ctl->DP]=kmalloc(sizeof(struct gred_sched_data),