Skip to content

Commit

Permalink
htb: fix sign extension bug
Browse files Browse the repository at this point in the history
[ Upstream commit cbd3755 ]

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>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
  • Loading branch information
stephen hemminger authored and Willy Tarreau committed May 19, 2014
1 parent f5a2119 commit 63251ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct htb_class {
unsigned int children;
struct htb_class *parent; /* parent class */

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 */

union {
Expand Down

0 comments on commit 63251ed

Please sign in to comment.