Skip to content

Commit 6bafcac

Browse files
Eric Dumazetdavem330
authored andcommitted
sch_qfq: fix overflow in qfq_update_start()
grp->slot_shift is between 22 and 41, so using 32bit wide variables is probably a typo. This could explain QFQ hangs Dave reported to me, after 2^23 packets ? (23 = 64 - 41) Reported-by: Dave Taht <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> CC: Stephen Hemminger <[email protected]> CC: Dave Taht <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 115e8e7 commit 6bafcac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/sched/sch_qfq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,11 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch)
817817
static void qfq_update_start(struct qfq_sched *q, struct qfq_class *cl)
818818
{
819819
unsigned long mask;
820-
uint32_t limit, roundedF;
820+
u64 limit, roundedF;
821821
int slot_shift = cl->grp->slot_shift;
822822

823823
roundedF = qfq_round_down(cl->F, slot_shift);
824-
limit = qfq_round_down(q->V, slot_shift) + (1UL << slot_shift);
824+
limit = qfq_round_down(q->V, slot_shift) + (1ULL << slot_shift);
825825

826826
if (!qfq_gt(cl->F, q->V) || qfq_gt(roundedF, limit)) {
827827
/* timestamp was stale */

0 commit comments

Comments
 (0)