Skip to content

Commit d4d6ec6

Browse files
congwangdavem330
authored andcommitted
sch_hhf: ensure quantum and hhf_non_hh_weight are non-zero
In case of TCA_HHF_NON_HH_WEIGHT or TCA_HHF_QUANTUM is zero, it would make no progress inside the loop in hhf_dequeue() thus kernel would get stuck. Fix this by checking this corner case in hhf_change(). Fixes: 10239ed ("net-qdisc-hhf: Heavy-Hitter Filter (HHF) qdisc") Reported-by: [email protected] Reported-by: [email protected] Reported-by: [email protected] Cc: Jamal Hadi Salim <[email protected]> Cc: Jiri Pirko <[email protected]> Cc: Terry Lam <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8b142a0 commit d4d6ec6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sched/sch_hhf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt,
531531
new_hhf_non_hh_weight = nla_get_u32(tb[TCA_HHF_NON_HH_WEIGHT]);
532532

533533
non_hh_quantum = (u64)new_quantum * new_hhf_non_hh_weight;
534-
if (non_hh_quantum > INT_MAX)
534+
if (non_hh_quantum == 0 || non_hh_quantum > INT_MAX)
535535
return -EINVAL;
536536

537537
sch_tree_lock(sch);

0 commit comments

Comments
 (0)