netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] pkt_sched: fq: avoid hang when quantum 0
@ 2015-02-03 16:49 Kenneth Klette Jonassen
  2015-02-03 17:46 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Kenneth Klette Jonassen @ 2015-02-03 16:49 UTC (permalink / raw)
  To: netdev; +Cc: Kenneth Klette Jonassen

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 <kennetkl@ifi.uio.no>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] pkt_sched: fq: avoid hang when quantum 0
  2015-02-03 16:49 [PATCH net] pkt_sched: fq: avoid hang when quantum 0 Kenneth Klette Jonassen
@ 2015-02-03 17:46 ` Eric Dumazet
  2015-02-05  4:08   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2015-02-03 17:46 UTC (permalink / raw)
  To: Kenneth Klette Jonassen; +Cc: netdev

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 <kennetkl@ifi.uio.no>
> ---

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] pkt_sched: fq: avoid hang when quantum 0
  2015-02-03 17:46 ` Eric Dumazet
@ 2015-02-05  4:08   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2015-02-05  4:08 UTC (permalink / raw)
  To: eric.dumazet; +Cc: kennetkl, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 03 Feb 2015 09:46:09 -0800

> 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 <kennetkl@ifi.uio.no>
>> ---
> 
> Acked-by: Eric Dumazet <edumazet@google.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-05  4:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 16:49 [PATCH net] pkt_sched: fq: avoid hang when quantum 0 Kenneth Klette Jonassen
2015-02-03 17:46 ` Eric Dumazet
2015-02-05  4:08   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).