* [PATCH] sched: fix virtual-start-time update in QFQ
@ 2012-09-15 10:41 Paolo Valente
2012-09-19 20:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Valente @ 2012-09-15 10:41 UTC (permalink / raw)
To: davem, shemminger, jhs
Cc: fchecconi, rizzo, netdev, linux-kernel, paolo.valente
If the old timestamps of a class, say cl, are stale when the class
becomes active, then QFQ may assign to cl a much higher start time
than the maximum value allowed. This may happen when QFQ assigns to
the start time of cl the finish time of a group whose classes are
characterized by a higher value of the ratio
max_class_pkt/weight_of_the_class with respect to that of
cl. Inserting a class with a too high start time into the bucket list
corrupts the data structure and may eventually lead to crashes.
This patch limits the maximum start time assigned to a class.
Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
---
net/sched/sch_qfq.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index e4723d3..211a212 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -865,7 +865,10 @@ static void qfq_update_start(struct qfq_sched *q, struct qfq_class *cl)
if (mask) {
struct qfq_group *next = qfq_ffs(q, mask);
if (qfq_gt(roundedF, next->F)) {
- cl->S = next->F;
+ if (qfq_gt(limit, next->F))
+ cl->S = next->F;
+ else /* preserve timestamp correctness */
+ cl->S = limit;
return;
}
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sched: fix virtual-start-time update in QFQ
2012-09-15 10:41 [PATCH] sched: fix virtual-start-time update in QFQ Paolo Valente
@ 2012-09-19 20:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-09-19 20:25 UTC (permalink / raw)
To: paolo.valente; +Cc: shemminger, jhs, fchecconi, rizzo, netdev, linux-kernel
From: Paolo Valente <paolo.valente@unimore.it>
Date: Sat, 15 Sep 2012 12:41:35 +0200
> If the old timestamps of a class, say cl, are stale when the class
> becomes active, then QFQ may assign to cl a much higher start time
> than the maximum value allowed. This may happen when QFQ assigns to
> the start time of cl the finish time of a group whose classes are
> characterized by a higher value of the ratio
> max_class_pkt/weight_of_the_class with respect to that of
> cl. Inserting a class with a too high start time into the bucket list
> corrupts the data structure and may eventually lead to crashes.
> This patch limits the maximum start time assigned to a class.
>
> Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Applied and queued up for -stable, thanks.
Please use "pkt_sched" instead of just plain "sched" in the prefixes
of your subject lines for packet scheduler changes so such changes
can be distinguished from process scheduler changes.
I fixed it up for you this time.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-19 20:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-15 10:41 [PATCH] sched: fix virtual-start-time update in QFQ Paolo Valente
2012-09-19 20:25 ` 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).