diff options
author | Paolo Valente <paolo.valente@unimore.it> | 2012-09-14 20:41:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-19 16:23:53 -0400 |
commit | 71261956973ba9e0637848a5adb4a5819b4bae83 (patch) | |
tree | b73da61b6f4ff0c5156f6f1a2252ed98304366a3 /net/sched/sch_qfq.c | |
parent | 15c041759bfcd9ab0a4e43f1c16e2644977d0467 (diff) |
pkt_sched: fix virtual-start-time update in QFQ
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_qfq.c')
-rw-r--r-- | net/sched/sch_qfq.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c index e4723d31fdd5..211a21217045 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) | |||
865 | if (mask) { | 865 | if (mask) { |
866 | struct qfq_group *next = qfq_ffs(q, mask); | 866 | struct qfq_group *next = qfq_ffs(q, mask); |
867 | if (qfq_gt(roundedF, next->F)) { | 867 | if (qfq_gt(roundedF, next->F)) { |
868 | cl->S = next->F; | 868 | if (qfq_gt(limit, next->F)) |
869 | cl->S = next->F; | ||
870 | else /* preserve timestamp correctness */ | ||
871 | cl->S = limit; | ||
869 | return; | 872 | return; |
870 | } | 873 | } |
871 | } | 874 | } |