diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index ed2f061b87685d6109021bd64d2029798c0ceb0f..f0bac6f7ab6bb768b12e51c937c0948e35ee5c07 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -808,6 +808,12 @@ int esp6_input_done2(struct sk_buff *skb, int err) struct tcphdr *th; offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off); + + if (offset < 0) { + err = -EINVAL; + goto out; + } + uh = (void *)(skb->data + offset); th = (void *)(skb->data + offset); hdr_len += offset;