public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber•org>
To: Cong Wang <xiyou.wangcong@gmail•com>
Cc: netdev@vger•kernel.org
Subject: Re: [Bug 60669] Kernel panic when using negative priority for HTB class
Date: Thu, 1 Aug 2013 22:31:15 -0700	[thread overview]
Message-ID: <20130801223115.59a1ac76@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <ktfdq8$882$1@ger.gmane.org>

On Fri, 2 Aug 2013 04:50:16 +0000 (UTC)
Cong Wang <xiyou.wangcong@gmail•com> wrote:

> On Fri, 02 Aug 2013 at 04:12 GMT, Stephen Hemminger <stephen@networkplumber•org> wrote:
> >
> > --- Comment #2 from _Vi <vi0oss@gmail•com> ---
> > Reproducible on 3.11.0-rc3
> >
> > Looks like negative priority value is essential for the kernel panic.
> >
> 
> There is a check for prio:
> 
>                 if ((cl->prio = hopt->prio) >= TC_HTB_NUMPRIO)
> 		                        cl->prio = TC_HTB_NUMPRIO - 1;
> 					

This maybe related to or old bugs, 64 bit with current
iproute2 the error is caught at the command level.

The issue is that hopt->prio is u32 but cl->prio is int.

Example:
int main()
{
	int x = -1;
	uint32_t prio = x;
	int cl;

	if ((cl = prio) >= TC_HTB_NUMPRIO)
		cl = TC_HTB_NUMPRIO - 1;

	printf("%d %u %d\n", x, prio, cl);
	return 0;
}
-1 4294967295 -1

Signed/unsigned conversions can bite.

  reply	other threads:[~2013-08-02  5:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02  4:12 Fw: [Bug 60669] Kernel panic when using negative priority for HTB class Stephen Hemminger
2013-08-02  4:50 ` Cong Wang
2013-08-02  5:31   ` Stephen Hemminger [this message]
     [not found]   ` <20130801221936.24d4b31e@nehalam.linuxnetplumber.net>
2013-08-02  5:32     ` [PATCH net-next] htb: fix sign extension bug Stephen Hemminger
2013-08-02 13:36       ` Eric Dumazet
2013-08-02 15:24         ` Stephen Hemminger
2013-08-02 21:53           ` David Miller
2013-08-02 21:52         ` 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=20130801223115.59a1ac76@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=xiyou.wangcong@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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