From: Kuniyuki Iwashima Date: Wed, 14 Jun 2023 23:01:07 +0000 (-0700) Subject: ipv6: exthdrs: Remove redundant skb_headlen() check in ip6_parse_tlv(). X-Git-Tag: v6.5-rc1~163^2~66^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6db5dd2bf4817a415daaf6a0226beadef1473d30;p=thirdparty%2Flinux.git ipv6: exthdrs: Remove redundant skb_headlen() check in ip6_parse_tlv(). ipv6_destopt_rcv() and ipv6_parse_hopopts() pulls these data - Hop-by-Hop/Destination Options Header : 8 - Hdr Ext Len : skb_transport_header(skb)[1] << 3 and calls ip6_parse_tlv(), so it need not check if skb_headlen() is less than skb_transport_offset(skb) + (skb_transport_header(skb)[1] << 3). Signed-off-by: Kuniyuki Iwashima Signed-off-by: Jakub Kicinski --- diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index dd23531387e3f..202fc3aaa83cc 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -126,9 +126,6 @@ static bool ip6_parse_tlv(bool hopbyhop, max_count = -max_count; } - if (skb_transport_offset(skb) + len > skb_headlen(skb)) - goto bad; - off += 2; len -= 2;