diff options
author | David S. Miller <davem@davemloft.net> | 2017-05-17 22:54:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-17 22:54:11 -0400 |
commit | 7dd7eb9513bd02184d45f000ab69d78cb1fa1531 (patch) | |
tree | 069fed66bdc18c6043c981748bb28057fbc1bcf2 /net/ipv6/ip6_output.c | |
parent | 579f1d926c66cc0bd3bd87b1fe2e091084b07430 (diff) | |
download | linux-stable-7dd7eb9513bd02184d45f000ab69d78cb1fa1531.tar.gz linux-stable-7dd7eb9513bd02184d45f000ab69d78cb1fa1531.tar.bz2 linux-stable-7dd7eb9513bd02184d45f000ab69d78cb1fa1531.zip |
ipv6: Check ip6_find_1stfragopt() return value properly.
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>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r-- | net/ipv6/ip6_output.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 01deecda2f84..d4a31becbd25 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -597,11 +597,10 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, int ptr, offset = 0, err = 0; u8 *prevhdr, nexthdr = 0; - hlen = ip6_find_1stfragopt(skb, &prevhdr); - if (hlen < 0) { - err = hlen; + err = ip6_find_1stfragopt(skb, &prevhdr); + if (err < 0) goto fail; - } + hlen = err; nexthdr = *prevhdr; mtu = ip6_skb_dst_mtu(skb); |