File tree 1 file changed +11
-2
lines changed 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1085,13 +1085,18 @@ static inline int
1085
1085
ip4ip6_tnl_xmit (struct sk_buff * skb , struct net_device * dev )
1086
1086
{
1087
1087
struct ip6_tnl * t = netdev_priv (dev );
1088
- const struct iphdr * iph = ip_hdr ( skb ) ;
1088
+ const struct iphdr * iph ;
1089
1089
int encap_limit = -1 ;
1090
1090
struct flowi6 fl6 ;
1091
1091
__u8 dsfield ;
1092
1092
__u32 mtu ;
1093
1093
int err ;
1094
1094
1095
+ /* ensure we can access the full inner ip header */
1096
+ if (!pskb_may_pull (skb , sizeof (struct iphdr )))
1097
+ return -1 ;
1098
+
1099
+ iph = ip_hdr (skb );
1095
1100
if ((t -> parms .proto != IPPROTO_IPIP && t -> parms .proto != 0 ) ||
1096
1101
!ip6_tnl_xmit_ctl (t ))
1097
1102
return -1 ;
@@ -1126,14 +1131,18 @@ static inline int
1126
1131
ip6ip6_tnl_xmit (struct sk_buff * skb , struct net_device * dev )
1127
1132
{
1128
1133
struct ip6_tnl * t = netdev_priv (dev );
1129
- struct ipv6hdr * ipv6h = ipv6_hdr ( skb ) ;
1134
+ struct ipv6hdr * ipv6h ;
1130
1135
int encap_limit = -1 ;
1131
1136
__u16 offset ;
1132
1137
struct flowi6 fl6 ;
1133
1138
__u8 dsfield ;
1134
1139
__u32 mtu ;
1135
1140
int err ;
1136
1141
1142
+ if (unlikely (!pskb_may_pull (skb , sizeof (* ipv6h ))))
1143
+ return -1 ;
1144
+
1145
+ ipv6h = ipv6_hdr (skb );
1137
1146
if ((t -> parms .proto != IPPROTO_IPV6 && t -> parms .proto != 0 ) ||
1138
1147
!ip6_tnl_xmit_ctl (t ) || ip6_tnl_addr_conflict (t , ipv6h ))
1139
1148
return -1 ;
You can’t perform that action at this time.
0 commit comments