diff options
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r-- | net/ipv6/exthdrs.c | 12 |
1 files changed, 7 insertions, 5 deletions
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); |