Skip to content

Commit

Permalink
net/sched: sch_qfq: reintroduce lmax bound check for MTU
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tammela authored and Paolo Abeni committed Jul 13, 2023
1 parent b0b0ab6 commit 158810b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions net/sched/sch_qfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,17 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
else
weight = 1;

if (tb[TCA_QFQ_LMAX])
if (tb[TCA_QFQ_LMAX]) {
lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
else
} else {
/* MTU size is user controlled */
lmax = psched_mtu(qdisc_dev(sch));
if (lmax < QFQ_MIN_LMAX || lmax > QFQ_MAX_LMAX) {
NL_SET_ERR_MSG_MOD(extack,
"MTU size out of bounds for qfq");
return -EINVAL;
}
}

inv_w = ONE_FP / weight;
weight = ONE_FP / inv_w;
Expand Down

0 comments on commit 158810b

Please sign in to comment.