[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210407163808.499027-1-colin.king@canonical.com>
Date: Wed, 7 Apr 2021 17:38:08 +0100
From: Colin King <colin.king@...onical.com>
To: Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S . Miller" <davem@...emloft.net>,
Gautam Ramakrishnan <gautamramk@...il.com>,
"Sachin D . Patil" <sdp.sachin@...il.com>,
Mohit Bhasi <mohitbhasi1998@...il.com>,
Leslie Monis <lesliemonis@...il.com>,
"Mohit P . Tahiliani" <tahiliani@...k.edu.in>,
netdev@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] net: sched: Fix potential infinite loop
From: Colin Ian King <colin.king@...onical.com>
The for-loop iterates with a u16 loop counter idx and compares this
with the loop upper limit of q->flows_cnt that is a u32 type.
There is a potential infinite loop if q->flows_cnt is larger than
the u8 loop counter. Fix this by making the loop counter the same
type as q->flows_cnt.
Addresses-Coverity: ("Infinite loop")
Fixes: ec97ecf1ebe4 ("net: sched: add Flow Queue PIE packet scheduler")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
net/sched/sch_fq_pie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_fq_pie.c b/net/sched/sch_fq_pie.c
index 949163fe68af..00563e137ecb 100644
--- a/net/sched/sch_fq_pie.c
+++ b/net/sched/sch_fq_pie.c
@@ -367,7 +367,7 @@ static void fq_pie_timer(struct timer_list *t)
struct fq_pie_sched_data *q = from_timer(q, t, adapt_timer);
struct Qdisc *sch = q->sch;
spinlock_t *root_lock; /* to lock qdisc for probability calculations */
- u16 idx;
+ u32 idx;
root_lock = qdisc_lock(qdisc_root_sleeping(sch));
spin_lock(root_lock);
--
2.30.2
Powered by blists - more mailing lists