Patch "net_sched: red: Avoid illegal values" has been added to the 4.14-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
net_sched: red: Avoid illegal values
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
net_sched-red-avoid-illegal-values.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Fri Feb 23 11:45:09 CET 2018
From: Nogah Frankel <[email protected]>
Date: Mon, 4 Dec 2017 13:31:11 +0200
Subject: net_sched: red: Avoid illegal values
From: Nogah Frankel <[email protected]>
[ Upstream commit 8afa10cbe281b10371fee5a87ab266e48d71a7f9 ]
Check the qmin & qmax values doesn't overflow for the given Wlog value. Check that qmin <= qmax.
--- include/net/red.h | 11 +++++++++++ net/sched/sch_choke.c | 3 +++ net/sched/sch_gred.c | 3 +++ net/sched/sch_red.c | 2 ++ net/sched/sch_sfq.c | 3 +++ 5 files changed, 22 insertions(+)
include/net/red.h +11 -0
@@ -168,6 +168,17 @@ static inline void red_set_vars(struct r v->qcount =-1 ; } +static inline bool red_check_params (u32 qth_min,u32 qth_max,u8 Wlog) +{ +if (fls (qth_min) + Wlog >32 ) +return false; +if (fls (qth_max) + Wlog >32 ) +return false; +if (qth_max < qth_min) +return false; +return true; +} +static inline void red_set_parms (struct red_parms *p,u32 qth_min,u32 qth_max,u8 Wlog,u8 Plog,u8 Scell_log,u8 *stab,u32 max_P)
net/sched/sch_choke.c +3 -0
@@ -369,6 +369,9 @@ static int choke_change(struct Qdisc *sc ctl =nla_data (tb[TCA_CHOKE_PARMS ]); +if (!red_check_params (ctl->qth_min, ctl->qth_max, ctl->Wlog)) +return -EINVAL ; +if (ctl->limit >CHOKE_MAX_QUEUE )return -EINVAL ;
net/sched/sch_gred.c +3 -0
@@ -356,6 +356,9 @@ static inline int gred_change_vq(structstruct 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 ;
net/sched/sch_red.c +2 -0
@@ -184,6 +184,8 @@ static int red_change(struct Qdisc *sch, max_P = tb[TCA_RED_MAX_P ] ?nla_get_u32 (tb[TCA_RED_MAX_P ]) :0 ; ctl =nla_data (tb[TCA_RED_PARMS ]); +if (!red_check_params (ctl->qth_min, ctl->qth_max, ctl->Wlog)) +return -EINVAL ;if (ctl->limit >0 ) { child =fifo_create_dflt (sch, &bfifo_qdisc_ops, ctl->limit);
net/sched/sch_sfq.c +3 -0
@@ -637,6 +637,9 @@ static int sfq_change(struct Qdisc *sch,if (ctl->divisor && (!is_power_of_2 (ctl->divisor) || ctl->divisor >65536 ))return -EINVAL ; +if (ctl_v1 && !red_check_params (ctl_v1->qth_min, ctl_v1->qth_max, + ctl_v1->Wlog)) +return -EINVAL ;if (ctl_v1 && ctl_v1->qth_min) { p =kmalloc (sizeof (*p),GFP_KERNEL );if (!p)
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/net_sched-red-avoid-devision-by-zero.patch queue-4.14/net_sched-red-avoid-illegal-values.patch