]> git.baikalelectronics.ru Git - kernel.git/commit
net: validate untrusted gso packets without csum offload
authorWillem de Bruijn <willemb@google.com>
Fri, 15 Feb 2019 17:15:47 +0000 (12:15 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sat, 16 Feb 2019 04:30:37 +0000 (20:30 -0800)
commitd69478c250c8a140b918e4b93e1b9bbe0607e909
tree611f6b5968dbaed249619d63ec6e060ad10d33c6
parent8e45a8e811c976b6e6d7aa1271ada524e9953876
net: validate untrusted gso packets without csum offload

Syzkaller again found a path to a kernel crash through bad gso input.
By building an excessively large packet to cause an skb field to wrap.

If VIRTIO_NET_HDR_F_NEEDS_CSUM was set this would have been dropped in
skb_partial_csum_set.

GSO packets that do not set checksum offload are suspicious and rare.
Most callers of virtio_net_hdr_to_skb already pass them to
skb_probe_transport_header.

Move that test forward, change it to detect parse failure and drop
packets on failure as those cleary are not one of the legitimate
VIRTIO_NET_HDR_GSO types.

Fixes: 09a22ba4d6d4 ("packet: Add GSO/csum offload support.")
Fixes: 340bf86a628c ("tun: Allow GSO using virtio_net_hdr")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
include/linux/virtio_net.h