[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190908204051.760-1-xiyou.wangcong@gmail.com>
Date: Sun, 8 Sep 2019 13:40:51 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: netdev@...r.kernel.org
Cc: Cong Wang <xiyou.wangcong@...il.com>,
syzbot+bc6297c11f19ee807dc2@...kaller.appspotmail.com,
syzbot+041483004a7f45f1f20a@...kaller.appspotmail.com,
syzbot+55be5f513bed37fc4367@...kaller.appspotmail.com,
Jamal Hadi Salim <jhs@...atatu.com>,
Jiri Pirko <jiri@...nulli.us>, Terry Lam <vtlam@...gle.com>
Subject: [Patch net] 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: 10239edf86f1 ("net-qdisc-hhf: Heavy-Hitter Filter (HHF) qdisc")
Reported-by: syzbot+bc6297c11f19ee807dc2@...kaller.appspotmail.com
Reported-by: syzbot+041483004a7f45f1f20a@...kaller.appspotmail.com
Reported-by: syzbot+55be5f513bed37fc4367@...kaller.appspotmail.com
Cc: Jamal Hadi Salim <jhs@...atatu.com>
Cc: Jiri Pirko <jiri@...nulli.us>
Cc: Terry Lam <vtlam@...gle.com>
Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
---
net/sched/sch_hhf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c
index cee6971c1c82..23cd1c873a2c 100644
--- a/net/sched/sch_hhf.c
+++ b/net/sched/sch_hhf.c
@@ -531,7 +531,7 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt,
new_hhf_non_hh_weight = nla_get_u32(tb[TCA_HHF_NON_HH_WEIGHT]);
non_hh_quantum = (u64)new_quantum * new_hhf_non_hh_weight;
- if (non_hh_quantum > INT_MAX)
+ if (non_hh_quantum == 0 || non_hh_quantum > INT_MAX)
return -EINVAL;
sch_tree_lock(sch);
--
2.21.0
Powered by blists - more mailing lists