]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: udp: fix IP header access and skb lookup on Fast/frag0 UDP GRO
authorAlexander Lobakin <alobakin@pm.me>
Wed, 11 Nov 2020 20:45:38 +0000 (20:45 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:22:31 +0000 (19:22 +0100)
commit7e7f05d83d00e38d10d5ac92b738d39dfee661ef
tree23057060a35caa89ff59d60ba14651746b231636
parentd0f1a4e3f60cbad46b4a01fb7da998df6f3d28a6
net: udp: fix IP header access and skb lookup on Fast/frag0 UDP GRO

[ Upstream commit 55e729889bb07d68ab071660ce3f5e7a7872ebe8 ]

udp{4,6}_lib_lookup_skb() use ip{,v6}_hdr() to get IP header of the
packet. While it's probably OK for non-frag0 paths, this helpers
will also point to junk on Fast/frag0 GRO when all headers are
located in frags. As a result, sk/skb lookup may fail or give wrong
results. To support both GRO modes, skb_gro_network_header() might
be used. To not modify original functions, add private versions of
udp{4,6}_lib_lookup_skb() only to perform correct sk lookups on GRO.

Present since the introduction of "application-level" UDP GRO
in 4.7-rc1.

Misc: replace totally unneeded ternaries with plain ifs.

Fixes: a6024562ffd7 ("udp: Add GRO functions to UDP socket")
Suggested-by: Willem de Bruijn <willemb@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/udp_offload.c
net/ipv6/udp_offload.c