]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: stricter validation of untrusted gso packets
authorWillem de Bruijn <willemb@google.com>
Mon, 4 May 2020 16:48:54 +0000 (12:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2020 05:57:19 +0000 (07:57 +0200)
commitf12aa513fe47e910bed3526e57ae1ce6c9412e24
tree852bb218c45cb2b7340758eaa1e3af52d437ad02
parent2d79fe56f066acaecc41d691221ae6b8e72b7d29
net: stricter validation of untrusted gso packets

[ Upstream commit 9274124f023b5c56dc4326637d4f787968b03607 ]

Syzkaller again found a path to a kernel crash through bad gso input:
a packet with transport header extending beyond skb_headlen(skb).

Tighten validation at kernel entry:

- Verify that the transport header lies within the linear section.

    To avoid pulling linux/tcp.h, verify just sizeof tcphdr.
    tcp_gso_segment will call pskb_may_pull (th->doff * 4) before use.

- Match the gso_type against the ip_proto found by the flow dissector.

Fixes: bfd5f4a3d605 ("packet: Add GSO/csum offload support.")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/virtio_net.h