@@ -401,7 +401,7 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw)
401
401
const struct ipv6hdr * ipv6h = (const struct ipv6hdr * )raw ;
402
402
unsigned int nhoff = raw - skb -> data ;
403
403
unsigned int off = nhoff + sizeof (* ipv6h );
404
- u8 next , nexthdr = ipv6h -> nexthdr ;
404
+ u8 nexthdr = ipv6h -> nexthdr ;
405
405
406
406
while (ipv6_ext_hdr (nexthdr ) && nexthdr != NEXTHDR_NONE ) {
407
407
struct ipv6_opt_hdr * hdr ;
@@ -412,25 +412,25 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw)
412
412
413
413
hdr = (struct ipv6_opt_hdr * )(skb -> data + off );
414
414
if (nexthdr == NEXTHDR_FRAGMENT ) {
415
- struct frag_hdr * frag_hdr = (struct frag_hdr * ) hdr ;
416
- if (frag_hdr -> frag_off )
417
- break ;
418
415
optlen = 8 ;
419
416
} else if (nexthdr == NEXTHDR_AUTH ) {
420
417
optlen = ipv6_authlen (hdr );
421
418
} else {
422
419
optlen = ipv6_optlen (hdr );
423
420
}
424
- /* cache hdr->nexthdr, since pskb_may_pull() might
425
- * invalidate hdr
426
- */
427
- next = hdr -> nexthdr ;
428
- if (nexthdr == NEXTHDR_DEST ) {
429
- u16 i = 2 ;
430
421
431
- /* Remember : hdr is no longer valid at this point. */
432
- if (!pskb_may_pull (skb , off + optlen ))
422
+ if (!pskb_may_pull (skb , off + optlen ))
423
+ break ;
424
+
425
+ hdr = (struct ipv6_opt_hdr * )(skb -> data + off );
426
+ if (nexthdr == NEXTHDR_FRAGMENT ) {
427
+ struct frag_hdr * frag_hdr = (struct frag_hdr * )hdr ;
428
+
429
+ if (frag_hdr -> frag_off )
433
430
break ;
431
+ }
432
+ if (nexthdr == NEXTHDR_DEST ) {
433
+ u16 i = 2 ;
434
434
435
435
while (1 ) {
436
436
struct ipv6_tlv_tnl_enc_lim * tel ;
@@ -451,7 +451,7 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw)
451
451
i ++ ;
452
452
}
453
453
}
454
- nexthdr = next ;
454
+ nexthdr = hdr -> nexthdr ;
455
455
off += optlen ;
456
456
}
457
457
return 0 ;
0 commit comments