aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_u32.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-08-02 09:44:13 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-03 01:07:45 -0400
commit66d50d25502cd9b7d6e3ebbf4e241259c1283eaf (patch)
treea8738a77a087122167a2d881a8d0833255bbadb4 /net/sched/cls_u32.c
parenteabd8ba9060444cac5b89a3306e607c15ec37418 (diff)
u32: negative offset fix
It was possible to use a negative offset in a u32 match to reference the ethernet header or other parts of the link layer header. This fixes the regression caused by: commit fbc2e7d9cf49e0bf89b9e91fd60a06851a855c5d Author: Changli Gao <xiaosuo@gmail.com> Date: Wed Jun 2 07:32:42 2010 -0700 cls_u32: use skb_header_pointer() to dereference data safely Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_u32.c')
-rw-r--r--net/sched/cls_u32.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 4f522143811e..7416a5c73b2a 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -134,10 +134,12 @@ next_knode:
134#endif 134#endif
135 135
136 for (i = n->sel.nkeys; i>0; i--, key++) { 136 for (i = n->sel.nkeys; i>0; i--, key++) {
137 unsigned int toff; 137 int toff = off + key->off + (off2 & key->offmask);
138 __be32 *data, _data; 138 __be32 *data, _data;
139 139
140 toff = off + key->off + (off2 & key->offmask); 140 if (skb_headroom(skb) + toff < 0)
141 goto out;
142
141 data = skb_header_pointer(skb, toff, 4, &_data); 143 data = skb_header_pointer(skb, toff, 4, &_data);
142 if (!data) 144 if (!data)
143 goto out; 145 goto out;