]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.0.96/htb-fix-sign-extension-bug.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 3.0.96 / htb-fix-sign-extension-bug.patch
1 From 1a1756eb58003653cbdf29d88e7402006ab7e2ff Mon Sep 17 00:00:00 2001
2 From: stephen hemminger <stephen@networkplumber.org>
3 Date: Thu, 1 Aug 2013 22:32:07 -0700
4 Subject: htb: fix sign extension bug
5
6 From: stephen hemminger <stephen@networkplumber.org>
7
8 [ Upstream commit cbd375567f7e4811b1c721f75ec519828ac6583f ]
9
10 When userspace passes a large priority value
11 the assignment of the unsigned value hopt->prio
12 to signed int cl->prio causes cl->prio to become negative and the
13 comparison is with TC_HTB_NUMPRIO is always false.
14
15 The result is that HTB crashes by referencing outside
16 the array when processing packets. With this patch the large value
17 wraps around like other values outside the normal range.
18
19 See: https://bugzilla.kernel.org/show_bug.cgi?id=60669
20
21 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
22 Acked-by: Eric Dumazet <edumazet@google.com>
23 Signed-off-by: David S. Miller <davem@davemloft.net>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 net/sched/sch_htb.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
28
29 --- a/net/sched/sch_htb.c
30 +++ b/net/sched/sch_htb.c
31 @@ -86,7 +86,7 @@ struct htb_class {
32 unsigned int children;
33 struct htb_class *parent; /* parent class */
34
35 - int prio; /* these two are used only by leaves... */
36 + u32 prio; /* these two are used only by leaves... */
37 int quantum; /* but stored for parent-to-leaf return */
38
39 union {