aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcpv6_offload.c
diff options
context:
space:
mode:
authorWillem de Bruijn <willemb@google.com>2018-01-19 09:29:18 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-22 16:01:30 -0500
commit121d57af308d0cf943f08f4738d24d3966c38cd9 (patch)
tree6089dfcad08b4d02fe8e8082f2d278a5cbec05a3 /net/ipv6/tcpv6_offload.c
parentnet: qdisc_pkt_len_init() should be more robust (diff)
downloadlinux-dev-121d57af308d0cf943f08f4738d24d3966c38cd9.tar.xz
linux-dev-121d57af308d0cf943f08f4738d24d3966c38cd9.zip
gso: validate gso_type in GSO handlers
Validate gso_type during segmentation as SKB_GSO_DODGY sources may pass packets where the gso_type does not match the contents. Syzkaller was able to enter the SCTP gso handler with a packet of gso_type SKB_GSO_TCPV4. On entry of transport layer gso handlers, verify that the gso_type matches the transport protocol. Fixes: 90017accff61 ("sctp: Add GSO support") Link: http://lkml.kernel.org/r/<001a1137452496ffc305617e5fe0@google.com> Reported-by: syzbot+fee64147a25aecd48055@syzkaller.appspotmail.com Signed-off-by: Willem de Bruijn <willemb@google.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcpv6_offload.c')
-rw-r--r--net/ipv6/tcpv6_offload.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c
index d883c9204c01..278e49cd67d4 100644
--- a/net/ipv6/tcpv6_offload.c
+++ b/net/ipv6/tcpv6_offload.c
@@ -46,6 +46,9 @@ static struct sk_buff *tcp6_gso_segment(struct sk_buff *skb,
{
struct tcphdr *th;
+ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6))
+ return ERR_PTR(-EINVAL);
+
if (!pskb_may_pull(skb, sizeof(*th)))
return ERR_PTR(-EINVAL);