From a8aaa9958eea2420e13d5a00c3fae934e0a3889e Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Sat, 5 Nov 2005 21:14:14 +0100 Subject: [PKT_SCHED]: GRED: Report out-of-bound DPs as illegal Signed-off-by: Thomas Graf Signed-off-by: Arnaldo Carvalho de Melo --- net/sched/sch_gred.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'net/sched/sch_gred.c') 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) 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), -- cgit v1.2.1