Skip to content

Commit d34a347

Browse files
tammelagregkh
authored andcommitted
net/sched: sch_qfq: reintroduce lmax bound check for MTU
commit 158810b upstream. 2536989 deletes a check for the case where no 'lmax' is specified which 3037933 previously fixed as 'lmax' could be set to the device's MTU without any bound checking for QFQ_LMAX_MIN and QFQ_LMAX_MAX. Therefore, reintroduce the check. Fixes: 2536989 ("net/sched: sch_qfq: refactor parsing of netlink parameters") Acked-by: Jamal Hadi Salim <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ff06cd4 commit d34a347

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

net/sched/sch_qfq.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,17 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
428428
else
429429
weight = 1;
430430

431-
if (tb[TCA_QFQ_LMAX])
431+
if (tb[TCA_QFQ_LMAX]) {
432432
lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
433-
else
433+
} else {
434+
/* MTU size is user controlled */
434435
lmax = psched_mtu(qdisc_dev(sch));
436+
if (lmax < QFQ_MIN_LMAX || lmax > QFQ_MAX_LMAX) {
437+
NL_SET_ERR_MSG_MOD(extack,
438+
"MTU size out of bounds for qfq");
439+
return -EINVAL;
440+
}
441+
}
435442

436443
inv_w = ONE_FP / weight;
437444
weight = ONE_FP / inv_w;

0 commit comments

Comments
 (0)