From: Stephen Hemminger <stephen@networkplumber.org>
To: David Miller <davem@davemloft.net>
Cc: Cong Wang <xiyou.wangcong@gmail.com>, netdev@vger.kernel.org
Subject: [PATCH net-next] htb: fix sign extension bug
Date: Thu, 1 Aug 2013 22:32:07 -0700 [thread overview]
Message-ID: <20130801223207.2a9c69e9@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <20130801221936.24d4b31e@nehalam.linuxnetplumber.net>
When userspace passes a large priority value
the assignment of the unsigned value hopt->prio
to signed int cl->prio causes cl->prio to become negative and the
comparison is with TC_HTB_NUMPRIO is always false.
The result is that HTB crashes by referencing outside
the array when processing packets. With this patch the large value
wraps around like other values outside the normal range.
See: https://bugzilla.kernel.org/show_bug.cgi?id=60669
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/net/sched/sch_htb.c 2013-06-20 09:22:46.489542435 -0700
+++ b/net/sched/sch_htb.c 2013-08-01 22:12:43.736307055 -0700
@@ -100,7 +100,7 @@ struct htb_class {
struct psched_ratecfg ceil;
s64 buffer, cbuffer;/* token bucket depth/rate */
s64 mbuffer; /* max wait time */
- int prio; /* these two are used only by leaves... */
+ u32 prio; /* these two are used only by leaves... */
int quantum; /* but stored for parent-to-leaf return */
struct tcf_proto *filter_list; /* class attached filters */
next prev parent 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
[not found] ` <20130801221936.24d4b31e@nehalam.linuxnetplumber.net>
2013-08-02 5:32 ` Stephen Hemminger [this message]
2013-08-02 13:36 ` [PATCH net-next] htb: fix sign extension bug 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=20130801223207.2a9c69e9@nehalam.linuxnetplumber.net \
--to=stephen@networkplumber.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.