android_kernel_xiaomi_sm7250/include
Balazs Nemeth 54ef8243c3 net: check if protocol extracted by virtio_net_hdr_set_proto is correct
commit 924a9bc362a5223cd448ca08c3dde21235adc310 upstream.

For gso packets, virtio_net_hdr_set_proto sets the protocol (if it isn't
set) based on the type in the virtio net hdr, but the skb could contain
anything since it could come from packet_snd through a raw socket. If
there is a mismatch between what virtio_net_hdr_set_proto sets and
the actual protocol, then the skb could be handled incorrectly later
on.

An example where this poses an issue is with the subsequent call to
skb_flow_dissect_flow_keys_basic which relies on skb->protocol being set
correctly. A specially crafted packet could fool
skb_flow_dissect_flow_keys_basic preventing EINVAL to be returned.

Avoid blindly trusting the information provided by the virtio net header
by checking that the protocol in the packet actually matches the
protocol set by virtio_net_hdr_set_proto. Note that since the protocol
is only checked if skb->dev implements header_ops->parse_protocol,
packets from devices without the implementation are not checked at this
stage.

Fixes: 9274124f023b ("net: stricter validation of untrusted gso packets")
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Acked-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>
2021-03-17 16:43:43 +01:00
..
acpi ACPICA: Fix exception code class checks 2021-03-04 09:39:33 +01:00
asm-generic vmlinux.lds.h: add DWARF v5 sections 2021-03-04 09:39:30 +01:00
clocksource
crypto crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock() 2020-07-09 09:37:10 +02:00
drm drm/atomic_helper: Stop modesets on unregistered connectors harder 2020-12-02 08:48:08 +01:00
dt-bindings
keys
kvm
linux net: check if protocol extracted by virtio_net_hdr_set_proto is correct 2021-03-17 16:43:43 +01:00
math-emu
media
memory
misc
net tcp: annotate tp->write_seq lockless reads 2021-03-17 16:43:43 +01:00
pcmcia
ras
rdma RDMA/core: Fix double destruction of uobject 2020-06-03 08:19:43 +02:00
scsi scsi: libiscsi: Fix NOP race condition 2020-12-02 08:48:09 +01:00
soc irqchip/eznps: Fix build error for !ARC700 builds 2020-09-17 13:45:25 +02:00
sound ASoC: rt5670: Add new gpio1_is_ext_spk_en quirk and enable it on the Lenovo Miix 2 10 2020-07-29 10:16:58 +02:00
target
trace memcg: fix a crash in wb_workfn when a device disappears 2021-02-13 13:51:15 +01:00
uapi uapi: nfnetlink_cthelper.h: fix userspace compilation error 2021-03-17 16:43:42 +01:00
video
xen Xen/gntdev: correct error checking in gntdev_map_grant_pages() 2021-02-23 15:00:59 +01:00