diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-04-21 12:06:25 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-04-21 12:06:25 +0800 |
commit | 2bf7955152a0544342fcaed28930748cc68392ae (patch) | |
tree | d6900b5e4330d173b94fac3cbe2188eba2673771 /drivers/net/vrf.c | |
parent | ad592b70ae97800d4f5bf535d45a680649e2789e (diff) | |
parent | 8c9aef03d3b540b6885e7534a885ea25f62dd9ed (diff) |
Merge tag 'v4.4.8' into linux-linaro-lsk-v4.4lsk-v4.4-16.04
This is the 4.4.8 stable release
Diffstat (limited to 'drivers/net/vrf.c')
-rw-r--r-- | drivers/net/vrf.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 0a242b200df4..903bda437839 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -114,20 +114,23 @@ static struct dst_ops vrf_dst_ops = { #if IS_ENABLED(CONFIG_IPV6) static bool check_ipv6_frame(const struct sk_buff *skb) { - const struct ipv6hdr *ipv6h = (struct ipv6hdr *)skb->data; - size_t hlen = sizeof(*ipv6h); + const struct ipv6hdr *ipv6h; + struct ipv6hdr _ipv6h; bool rc = true; - if (skb->len < hlen) + ipv6h = skb_header_pointer(skb, 0, sizeof(_ipv6h), &_ipv6h); + if (!ipv6h) goto out; if (ipv6h->nexthdr == NEXTHDR_ICMP) { const struct icmp6hdr *icmph; + struct icmp6hdr _icmph; - if (skb->len < hlen + sizeof(*icmph)) + icmph = skb_header_pointer(skb, sizeof(_ipv6h), + sizeof(_icmph), &_icmph); + if (!icmph) goto out; - icmph = (struct icmp6hdr *)(skb->data + sizeof(*ipv6h)); switch (icmph->icmp6_type) { case NDISC_ROUTER_SOLICITATION: case NDISC_ROUTER_ADVERTISEMENT: |