udp: consistently apply ufo or fragmentation
authorWillem de Bruijn <willemb@google.com>
Thu, 10 Aug 2017 16:29:19 +0000 (12:29 -0400)
committerWilly Tarreau <w@1wt.eu>
Wed, 1 Nov 2017 21:12:41 +0000 (22:12 +0100)
commit69ddef7b41fdad8123a9a4a6eb2a1aa57aafc92b
tree66ff4ce5c1e19661b8de32fa510aef99b3cc5d0e
parentb673e043f91c569cfe55241fa0b95c9007a9459b
udp: consistently apply ufo or fragmentation

commit 85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa upstream.

When iteratively building a UDP datagram with MSG_MORE and that
datagram exceeds MTU, consistently choose UFO or fragmentation.

Once skb_is_gso, always apply ufo. Conversely, once a datagram is
split across multiple skbs, do not consider ufo.

Sendpage already maintains the first invariant, only add the second.
IPv6 does not have a sendpage implementation to modify.

A gso skb must have a partial checksum, do not follow sk_no_check_tx
in udp_send_skb.

Found by syzkaller.

[gregkh - tweaks for 3.18 for ipv6, hopefully they are correct...]
[wt: s/skb_is_gso/skb_has_frags for 3.10]

Fixes: e89e9cf539a2 ("[IPv4/IPv6]: UFO Scatter-gather approach")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/ipv4/ip_output.c
net/ipv4/udp.c
net/ipv6/ip6_output.c