]> git.baikalelectronics.ru Git - kernel.git/commit
net: add recursion limit to GRO
authorSabrina Dubroca <sd@queasysnail.net>
Thu, 20 Oct 2016 13:58:02 +0000 (15:58 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Oct 2016 18:32:22 +0000 (14:32 -0400)
commitecbb07e1d5ce27d444f6c3c4b67f3e504da8ed8a
tree5bf8afb23894d48dda7ba09bdf4ab12935d81159
parenta7fc22dce1b1fd0359d514da2a0aee54e2c04562
net: add recursion limit to GRO

Currently, GRO can do unlimited recursion through the gro_receive
handlers.  This was fixed for tunneling protocols by limiting tunnel GRO
to one level with encap_mark, but both VLAN and TEB still have this
problem.  Thus, the kernel is vulnerable to a stack overflow, if we
receive a packet composed entirely of VLAN headers.

This patch adds a recursion counter to the GRO layer to prevent stack
overflow.  When a gro_receive function hits the recursion limit, GRO is
aborted for this skb and it is processed normally.  This recursion
counter is put in the GRO CB, but could be turned into a percpu counter
if we run out of space in the CB.

Thanks to Vladimír Beneš <vbenes@redhat.com> for the initial bug report.

Fixes: CVE-2016-7039
Fixes: 261932fba6a3 ("net: Add Transparent Ethernet Bridging GRO support.")
Fixes: 07697aecc9d7 ("vlan: Add GRO support for non hardware accelerated vlan")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/geneve.c
drivers/net/vxlan.c
include/linux/netdevice.h
net/8021q/vlan.c
net/core/dev.c
net/ethernet/eth.c
net/ipv4/af_inet.c
net/ipv4/fou.c
net/ipv4/gre_offload.c
net/ipv4/udp_offload.c
net/ipv6/ip6_offload.c