public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Eric Dumazet <eric.dumazet@gmail.com>, Luigi Rizzo <rizzo@iet.unipi.it>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>, Dave Taht <dave.taht@gmail.com>
Subject: Re: [PATCH] sch_qfq: fix overflow in qfq_update_start()
Date: Tue, 3 Jan 2012 08:25:57 -0800	[thread overview]
Message-ID: <20120103082557.5c5cb962@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1325519277.2375.24.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Mon, 02 Jan 2012 16:47:57 +0100
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> 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 <dave.taht@gmail.com>
> CC: Stephen Hemminger <shemminger@vyatta.com>
> CC: Dave Taht <dave.taht@gmail.com>
> ---
>  net/sched/sch_qfq.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
> index 1033434..7b03254 100644
> --- a/net/sched/sch_qfq.c
> +++ b/net/sched/sch_qfq.c
> @@ -817,11 +817,11 @@ skip_unblock:
>  static void qfq_update_start(struct qfq_sched *q, struct qfq_class *cl)
>  {
>  	unsigned long mask;
> -	uint32_t limit, roundedF;
> +	u64 limit, roundedF;
>  	int slot_shift = cl->grp->slot_shift;
>  
>  	roundedF = qfq_round_down(cl->F, slot_shift);
> -	limit = qfq_round_down(q->V, slot_shift) + (1UL << slot_shift);
> +	limit = qfq_round_down(q->V, slot_shift) + (1ULL << slot_shift);
>  
>  	if (!qfq_gt(cl->F, q->V) || qfq_gt(roundedF, limit)) {
>  		/* timestamp was stale */
> 
> 


You need to copy the BSD developers on these patches since
most of the code came from them and FreeBSD probably still has same bug!

  parent reply	other threads:[~2012-01-03 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 15:47 [PATCH] sch_qfq: fix overflow in qfq_update_start() Eric Dumazet
2012-01-02 21:45 ` Eric Dumazet
2012-01-02 21:56   ` Dave Taht
2012-01-03 16:25 ` Stephen Hemminger [this message]
2012-01-03 16:54   ` Luigi Rizzo
2012-01-03 17:59 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120103082557.5c5cb962@nehalam.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=dave.taht@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rizzo@iet.unipi.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox