summaryrefslogtreecommitdiffstats
path: root/net/sched/sch_gred.c
diff options
context:
space:
mode:
authorNogah Frankel <nogahf@mellanox.com>2017-12-04 12:31:11 +0100
committerDavid S. Miller <davem@davemloft.net>2017-12-05 20:37:13 +0100
commit8afa10cbe281b10371fee5a87ab266e48d71a7f9 (patch)
treef821390027974ff7b78d22df3862e181bea9d2ca /net/sched/sch_gred.c
parentnet_sched: red: Avoid devision by zero (diff)
downloadlinux-8afa10cbe281b10371fee5a87ab266e48d71a7f9.tar.xz
linux-8afa10cbe281b10371fee5a87ab266e48d71a7f9.zip
net_sched: red: Avoid illegal values
Check the qmin & qmax values doesn't overflow for the given Wlog value. Check that qmin <= qmax. Fixes: a783474591f2 ("[PKT_SCHED]: Generic RED layer") Signed-off-by: Nogah Frankel <nogahf@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_gred.c')
-rw-r--r--net/sched/sch_gred.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 17c7130454bd..bc30f9186ac6 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -356,6 +356,9 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp,
struct gred_sched *table = qdisc_priv(sch);
struct gred_sched_data *q = table->tab[dp];
+ if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
+ return -EINVAL;
+
if (!q) {
table->tab[dp] = q = *prealloc;
*prealloc = NULL;