summaryrefslogtreecommitdiff
path: root/net/ipv6/udp_offload.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-05-18 05:54:11 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-07 13:01:51 +0300
commitef4656afd6d78367b57cc3d6de4f3b1603523799 (patch)
treef5f840febe3e16a6dde159a526efa844ade02fd6 /net/ipv6/udp_offload.c
parent5ca68dbb5a6bb81c6119a6808e1dd8d1a53febc8 (diff)
downloadlinux-ef4656afd6d78367b57cc3d6de4f3b1603523799.tar.xz
ipv6: Check ip6_find_1stfragopt() return value properly.
[ Upstream commit 7dd7eb9513bd02184d45f000ab69d78cb1fa1531 ] Do not use unsigned variables to see if it returns a negative error or not. Fixes: 2423496af35d ("ipv6: Prevent overrun when parsing v6 header options") Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv6/udp_offload.c')
-rw-r--r--net/ipv6/udp_offload.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index b032886ae976..050d556a7997 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -29,6 +29,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
u8 frag_hdr_sz = sizeof(struct frag_hdr);
__wsum csum;
int tnl_hlen;
+ int err;
mss = skb_shinfo(skb)->gso_size;
if (unlikely(skb->len <= mss))
@@ -93,9 +94,10 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
/* Find the unfragmentable header and shift it left by frag_hdr_sz
* bytes to insert fragment header.
*/
- unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr);
- if (unfrag_ip6hlen < 0)
- return ERR_PTR(unfrag_ip6hlen);
+ err = ip6_find_1stfragopt(skb, &prevhdr);
+ if (err < 0)
+ return ERR_PTR(err);
+ unfrag_ip6hlen = err;
nexthdr = *prevhdr;
*prevhdr = NEXTHDR_FRAGMENT;
unfrag_len = (skb_network_header(skb) - skb_mac_header(skb)) +