diff options
Diffstat (limited to 'net/ipv6/ip6_input.c')
| -rw-r--r-- | net/ipv6/ip6_input.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index aceee252503d..6b8e6d76a58b 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
| @@ -71,6 +71,8 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
| 71 | goto out; | 71 | goto out; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm)); | ||
| 75 | |||
| 74 | /* | 76 | /* |
| 75 | * Store incoming device index. When the packet will | 77 | * Store incoming device index. When the packet will |
| 76 | * be queued, we cannot refer to skb->dev anymore. | 78 | * be queued, we cannot refer to skb->dev anymore. |
| @@ -84,14 +86,9 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
| 84 | */ | 86 | */ |
| 85 | IP6CB(skb)->iif = skb->dst ? ((struct rt6_info *)skb->dst)->rt6i_idev->dev->ifindex : dev->ifindex; | 87 | IP6CB(skb)->iif = skb->dst ? ((struct rt6_info *)skb->dst)->rt6i_idev->dev->ifindex : dev->ifindex; |
| 86 | 88 | ||
| 87 | if (skb->len < sizeof(struct ipv6hdr)) | 89 | if (unlikely(!pskb_may_pull(skb, sizeof(*hdr)))) |
| 88 | goto err; | 90 | goto err; |
| 89 | 91 | ||
| 90 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) { | ||
| 91 | IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); | ||
| 92 | goto drop; | ||
| 93 | } | ||
| 94 | |||
| 95 | hdr = skb->nh.ipv6h; | 92 | hdr = skb->nh.ipv6h; |
| 96 | 93 | ||
| 97 | if (hdr->version != 6) | 94 | if (hdr->version != 6) |
| @@ -114,7 +111,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
| 114 | } | 111 | } |
| 115 | 112 | ||
| 116 | if (hdr->nexthdr == NEXTHDR_HOP) { | 113 | if (hdr->nexthdr == NEXTHDR_HOP) { |
| 117 | if (ipv6_parse_hopopts(skb) < 0) { | 114 | if (ipv6_parse_hopopts(&skb) < 0) { |
| 118 | IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); | 115 | IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); |
| 119 | return 0; | 116 | return 0; |
| 120 | } | 117 | } |
