[PATCH net] pkt_sched: fq: avoid hang when quantum 0

Subsystems: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

STALE4282d

3 messages, 3 authors, 2015-02-05 · open the first message on its own page

[PATCH net] pkt_sched: fq: avoid hang when quantum 0

From: Kenneth Klette Jonassen <hidden>
Date: 2015-02-03 16:50:16

Configuring fq with quantum 0 hangs the system, presumably because of a
non-interruptible infinite loop. Either way quantum 0 does not make sense.

Reproduce with:
sudo tc qdisc add dev lo root fq quantum 0 initial_quantum 0
ping 127.0.0.1

Signed-off-by: Kenneth Klette Jonassen <redacted>
---
 net/sched/sch_fq.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index 2a50f5c..313794b 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -670,8 +670,14 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt)
 	if (tb[TCA_FQ_FLOW_PLIMIT])
 		q->flow_plimit = nla_get_u32(tb[TCA_FQ_FLOW_PLIMIT]);
 
-	if (tb[TCA_FQ_QUANTUM])
-		q->quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]);
+	if (tb[TCA_FQ_QUANTUM]) {
+		u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]);
+
+		if (quantum > 0)
+			q->quantum = quantum;
+		else
+			err = -EINVAL;
+	}
 
 	if (tb[TCA_FQ_INITIAL_QUANTUM])
 		q->initial_quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]);
-- 
1.9.1

Re: [PATCH net] pkt_sched: fq: avoid hang when quantum 0

From: Eric Dumazet <hidden>
Date: 2015-02-03 17:46:12

On Tue, 2015-02-03 at 17:49 +0100, Kenneth Klette Jonassen wrote:
Configuring fq with quantum 0 hangs the system, presumably because of a
non-interruptible infinite loop. Either way quantum 0 does not make sense.

Reproduce with:
sudo tc qdisc add dev lo root fq quantum 0 initial_quantum 0
ping 127.0.0.1

Signed-off-by: Kenneth Klette Jonassen <redacted>
---
Acked-by: Eric Dumazet <redacted>

Re: [PATCH net] pkt_sched: fq: avoid hang when quantum 0

From: David Miller <davem@davemloft.net>
Date: 2015-02-05 04:08:10

From: Eric Dumazet <redacted>
Date: Tue, 03 Feb 2015 09:46:09 -0800
On Tue, 2015-02-03 at 17:49 +0100, Kenneth Klette Jonassen wrote:
quoted
Configuring fq with quantum 0 hangs the system, presumably because of a
non-interruptible infinite loop. Either way quantum 0 does not make sense.

Reproduce with:
sudo tc qdisc add dev lo root fq quantum 0 initial_quantum 0
ping 127.0.0.1

Signed-off-by: Kenneth Klette Jonassen <redacted>
---
Acked-by: Eric Dumazet <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help