diff options
| author | Mark Brown <broonie@kernel.org> | 2017-08-21 21:48:37 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2017-08-21 21:48:37 +0100 |
| commit | f13db334bf7b68b0086d04ab6a51517ba41123b4 (patch) | |
| tree | 1ce74e775b64e9804aa5bbece3cdc94fd309912b /net/ipv6/output_core.c | |
| parent | eb59d73cb535ba32df928f210fb9a8529bf465c0 (diff) | |
| parent | b47b91c8504c62f95ddff2876620d68697927bd4 (diff) | |
Merge branch 'topic/msm8916' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-const
Diffstat (limited to 'net/ipv6/output_core.c')
| -rw-r--r-- | net/ipv6/output_core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c index e9065b8d3af8..abb2c307fbe8 100644 --- a/net/ipv6/output_core.c +++ b/net/ipv6/output_core.c @@ -78,7 +78,7 @@ EXPORT_SYMBOL(ipv6_select_ident); int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) { - u16 offset = sizeof(struct ipv6hdr); + unsigned int offset = sizeof(struct ipv6hdr); unsigned int packet_len = skb_tail_pointer(skb) - skb_network_header(skb); int found_rhdr = 0; @@ -86,6 +86,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) while (offset <= packet_len) { struct ipv6_opt_hdr *exthdr; + unsigned int len; switch (**nexthdr) { @@ -111,7 +112,10 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) + offset); - offset += ipv6_optlen(exthdr); + len = ipv6_optlen(exthdr); + if (len + offset >= IPV6_MAXPLEN) + return -EINVAL; + offset += len; *nexthdr = &exthdr->nexthdr; } |
