Skip to content

Commit

Permalink
pkt_sched: fix virtual-start-time update in QFQ
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paolo Valente authored and David S. Miller committed Sep 19, 2012
1 parent 15c0417 commit 7126195
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/sched/sch_qfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 7126195

Please sign in to comment.