]> git.baikalelectronics.ru Git - kernel.git/commit
net: avoid false positives in untrusted gso validation
authorWillem de Bruijn <willemb@google.com>
Tue, 19 Feb 2019 04:37:12 +0000 (23:37 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Feb 2019 22:08:13 +0000 (14:08 -0800)
commit607bcd8e797165829529207870b7b32f66799368
tree4b85aa0a1cace6820ddfd86504c4e6550378c8a0
parentcab9f405d4b9fa71ef79b3e60cac1125e8a70438
net: avoid false positives in untrusted gso validation

GSO packets with vnet_hdr must conform to a small set of gso_types.
The below commit uses flow dissection to drop packets that do not.

But it has false positives when the skb is not fully initialized.
Dissection needs skb->protocol and skb->network_header.

Infer skb->protocol from gso_type as the two must agree.
SKB_GSO_UDP can use both ipv4 and ipv6, so try both.

Exclude callers for which network header offset is not known.

Fixes: d69478c250c8 ("net: validate untrusted gso packets without csum offload")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/virtio_net.h