aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephen hemminger <stephen@networkplumber.org>2013-08-01 22:32:07 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-14 06:54:54 -0700
commitf4cc06ac2d9fc7a483eb778abec66f60487687f4 (patch)
tree510c6ade5a264442fb718f9a03a4c47b8c7ea2eb
parent85cdabba08d484bdcc4b25f0bbc23ac60c75aa5b (diff)
htb: fix sign extension bug
[ Upstream commit cbd375567f7e4811b1c721f75ec519828ac6583f ] 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/sched/sch_htb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index adaedd79389..5c9f0b7b210 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -87,7 +87,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 {