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