]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Feb 2019 09:09:56 +0000 (10:09 +0100)
commit0dab7eb86ea06ce8c530785f1999948c6f223c96
treeb53b83a2e7cb2a198ab5f2e9451dfc5dcf407c2b
parentf709f7b28d76de327373598a0fda9f916c36b5e6
net: avoid false positives in untrusted gso validation

commit 9e8db5913264d3967b93c765a6a9e464d9c473db upstream.

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: d5be7f632bad ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/virtio_net.h