diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/esp6.c | 9 | ||||
-rw-r--r-- | net/ipv6/exthdrs.c | 12 | ||||
-rw-r--r-- | net/ipv6/ip6_input.c | 2 | ||||
-rw-r--r-- | net/ipv6/ipcomp6.c | 4 | ||||
-rw-r--r-- | net/ipv6/mip6.c | 5 | ||||
-rw-r--r-- | net/ipv6/raw.c | 4 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 3 |
7 files changed, 19 insertions, 20 deletions
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 7aff380e74ef..35905867ded1 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -42,21 +42,18 @@ | |||
42 | static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | 42 | static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) |
43 | { | 43 | { |
44 | int err; | 44 | int err; |
45 | int hdr_len; | ||
46 | struct ipv6hdr *top_iph; | 45 | struct ipv6hdr *top_iph; |
47 | struct ipv6_esp_hdr *esph; | 46 | struct ipv6_esp_hdr *esph; |
48 | struct crypto_blkcipher *tfm; | 47 | struct crypto_blkcipher *tfm; |
49 | struct blkcipher_desc desc; | 48 | struct blkcipher_desc desc; |
50 | struct esp_data *esp; | ||
51 | struct sk_buff *trailer; | 49 | struct sk_buff *trailer; |
52 | int blksize; | 50 | int blksize; |
53 | int clen; | 51 | int clen; |
54 | int alen; | 52 | int alen; |
55 | int nfrags; | 53 | int nfrags; |
56 | 54 | struct esp_data *esp = x->data; | |
57 | esp = x->data; | 55 | int hdr_len = (skb_transport_offset(skb) + |
58 | hdr_len = skb->h.raw - skb->data + | 56 | sizeof(*esph) + esp->conf.ivlen); |
59 | sizeof(*esph) + esp->conf.ivlen; | ||
60 | 57 | ||
61 | /* Strip IP+ESP header. */ | 58 | /* Strip IP+ESP header. */ |
62 | __skb_pull(skb, hdr_len); | 59 | __skb_pull(skb, hdr_len); |
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index dab069b0b3f6..1bda0299890e 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
@@ -146,7 +146,7 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp) | |||
146 | int off = skb->h.raw - skb->nh.raw; | 146 | int off = skb->h.raw - skb->nh.raw; |
147 | int len = ((skb->h.raw[1]+1)<<3); | 147 | int len = ((skb->h.raw[1]+1)<<3); |
148 | 148 | ||
149 | if ((skb->h.raw + len) - skb->data > skb_headlen(skb)) | 149 | if (skb_transport_offset(skb) + len > skb_headlen(skb)) |
150 | goto bad; | 150 | goto bad; |
151 | 151 | ||
152 | off += 2; | 152 | off += 2; |
@@ -288,8 +288,9 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp) | |||
288 | #endif | 288 | #endif |
289 | struct dst_entry *dst; | 289 | struct dst_entry *dst; |
290 | 290 | ||
291 | if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || | 291 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || |
292 | !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { | 292 | !pskb_may_pull(skb, (skb_transport_offset(skb) + |
293 | ((skb->h.raw[1] + 1) << 3)))) { | ||
293 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 294 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), |
294 | IPSTATS_MIB_INHDRERRORS); | 295 | IPSTATS_MIB_INHDRERRORS); |
295 | kfree_skb(skb); | 296 | kfree_skb(skb); |
@@ -387,8 +388,9 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp) | |||
387 | 388 | ||
388 | in6_dev_put(idev); | 389 | in6_dev_put(idev); |
389 | 390 | ||
390 | if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || | 391 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || |
391 | !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { | 392 | !pskb_may_pull(skb, (skb_transport_offset(skb) + |
393 | ((skb->h.raw[1] + 1) << 3)))) { | ||
392 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 394 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), |
393 | IPSTATS_MIB_INHDRERRORS); | 395 | IPSTATS_MIB_INHDRERRORS); |
394 | kfree_skb(skb); | 396 | kfree_skb(skb); |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 2dd32a2ca056..44275411d1a8 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -160,7 +160,7 @@ static inline int ip6_input_finish(struct sk_buff *skb) | |||
160 | rcu_read_lock(); | 160 | rcu_read_lock(); |
161 | resubmit: | 161 | resubmit: |
162 | idev = ip6_dst_idev(skb->dst); | 162 | idev = ip6_dst_idev(skb->dst); |
163 | if (!pskb_pull(skb, skb->h.raw - skb->data)) | 163 | if (!pskb_pull(skb, skb_transport_offset(skb))) |
164 | goto discard; | 164 | goto discard; |
165 | nhoff = IP6CB(skb)->nhoff; | 165 | nhoff = IP6CB(skb)->nhoff; |
166 | nexthdr = skb_network_header(skb)[nhoff]; | 166 | nexthdr = skb_network_header(skb)[nhoff]; |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index e2404a629680..4a6501695e98 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -124,15 +124,13 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
124 | { | 124 | { |
125 | int err; | 125 | int err; |
126 | struct ipv6hdr *top_iph; | 126 | struct ipv6hdr *top_iph; |
127 | int hdr_len; | ||
128 | struct ipv6_comp_hdr *ipch; | 127 | struct ipv6_comp_hdr *ipch; |
129 | struct ipcomp_data *ipcd = x->data; | 128 | struct ipcomp_data *ipcd = x->data; |
130 | int plen, dlen; | 129 | int plen, dlen; |
131 | u8 *start, *scratch; | 130 | u8 *start, *scratch; |
132 | struct crypto_comp *tfm; | 131 | struct crypto_comp *tfm; |
133 | int cpu; | 132 | int cpu; |
134 | 133 | int hdr_len = skb_transport_offset(skb); | |
135 | hdr_len = skb->h.raw - skb->data; | ||
136 | 134 | ||
137 | /* check whether datagram len is larger than threshold */ | 135 | /* check whether datagram len is larger than threshold */ |
138 | if ((skb->len - hdr_len) < ipcd->threshold) { | 136 | if ((skb->len - hdr_len) < ipcd->threshold) { |
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 7b5f9d82e801..85202891644e 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
@@ -90,8 +90,9 @@ int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) | |||
90 | { | 90 | { |
91 | struct ip6_mh *mh; | 91 | struct ip6_mh *mh; |
92 | 92 | ||
93 | if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) || | 93 | if (!pskb_may_pull(skb, (skb_transport_offset(skb)) + 8) || |
94 | !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) << 3))) | 94 | !pskb_may_pull(skb, (skb_transport_offset(skb) + |
95 | ((skb->h.raw[1] + 1) << 3)))) | ||
95 | return -1; | 96 | return -1; |
96 | 97 | ||
97 | mh = (struct ip6_mh *)skb->h.raw; | 98 | mh = (struct ip6_mh *)skb->h.raw; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 0e2b56ce0a56..bb049f1c2679 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -513,7 +513,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, | |||
513 | if (csum_skb) | 513 | if (csum_skb) |
514 | continue; | 514 | continue; |
515 | 515 | ||
516 | len = skb->len - (skb->h.raw - skb->data); | 516 | len = skb->len - skb_transport_offset(skb); |
517 | if (offset >= len) { | 517 | if (offset >= len) { |
518 | offset -= len; | 518 | offset -= len; |
519 | continue; | 519 | continue; |
@@ -525,7 +525,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, | |||
525 | skb = csum_skb; | 525 | skb = csum_skb; |
526 | } | 526 | } |
527 | 527 | ||
528 | offset += skb->h.raw - skb->data; | 528 | offset += skb_transport_offset(skb); |
529 | if (skb_copy_bits(skb, offset, &csum, 2)) | 529 | if (skb_copy_bits(skb, offset, &csum, 2)) |
530 | BUG(); | 530 | BUG(); |
531 | 531 | ||
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 2594f0fb290d..ef29a7bb97ce 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -718,7 +718,8 @@ static int ipv6_frag_rcv(struct sk_buff **skbp) | |||
718 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); | 718 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); |
719 | return -1; | 719 | return -1; |
720 | } | 720 | } |
721 | if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) { | 721 | if (!pskb_may_pull(skb, (skb_transport_offset(skb) + |
722 | sizeof(struct frag_hdr)))) { | ||
722 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); | 723 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); |
723 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); | 724 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); |
724 | return -1; | 725 | return -1; |