linux-stable/net
Eric Dumazet b617158dc0 tcp: be more careful in tcp_fragment()
Some applications set tiny SO_SNDBUF values and expect
TCP to just work. Recent patches to address CVE-2019-11478
broke them in case of losses, since retransmits might
be prevented.

We should allow these flows to make progress.

This patch allows the first and last skb in retransmit queue
to be split even if memory limits are hit.

It also adds the some room due to the fact that tcp_sendmsg()
and tcp_sendpage() might overshoot sk_wmem_queued by about one full
TSO skb (64KB size). Note this allowance was already present
in stable backports for kernels < 4.15

Note for < 4.15 backports :
 tcp_rtx_queue_tail() will probably look like :

static inline struct sk_buff *tcp_rtx_queue_tail(const struct sock *sk)
{
	struct sk_buff *skb = tcp_send_head(sk);

	return skb ? tcp_write_queue_prev(sk, skb) : tcp_write_queue_tail(sk);
}

Fixes: f070ef2ac6 ("tcp: tcp_fragment() should apply sane memory limits")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrew Prout <aprout@ll.mit.edu>
Tested-by: Andrew Prout <aprout@ll.mit.edu>
Tested-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Tested-by: Michal Kubecek <mkubecek@suse.cz>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Christoph Paasch <cpaasch@apple.com>
Cc: Jonathan Looney <jtl@netflix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-21 20:41:24 -07:00
..
6lowpan 6lowpan: no need to check return value of debugfs_create functions 2019-07-06 12:50:01 +02:00
9p 9p pull request for inclusion in 5.13 2019-07-12 17:31:19 -07:00
802
8021q
appletalk
atm
ax25
batman-adv Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-07-08 19:48:57 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2019-07-11 10:55:49 -07:00
bpf
bpfilter Kbuild updates for v5.3 2019-07-12 16:03:16 -07:00
bridge netfilter: bridge: make NF_TABLES_BRIDGE tristate 2019-07-19 18:08:14 +02:00
caif
can
ceph Lots of exciting things this time! 2019-07-18 11:05:25 -07:00
core net: flow_offload: add flow_block structure and use it 2019-07-19 21:27:45 -07:00
dcb
dccp proc/sysctl: add shared variables for range check 2019-07-18 17:08:07 -07:00
decnet
dns_resolver Revert "Merge tag 'keys-acl-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs" 2019-07-10 18:43:43 -07:00
dsa net: flow_offload: add flow_block structure and use it 2019-07-19 21:27:45 -07:00
ethernet
hsr hsr: switch ->dellink() to ->ndo_uninit() 2019-07-11 14:37:45 -07:00
ieee802154
ife
ipv4 tcp: be more careful in tcp_fragment() 2019-07-21 20:41:24 -07:00
ipv6 Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf 2019-07-19 21:25:10 -07:00
iucv
kcm
key Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-07-08 19:48:57 -07:00
l2tp ipv6: elide flowlabel check if no exclusive leases exist 2019-07-08 19:38:03 -07:00
l3mdev
lapb
llc
mac80211 mac80211: don't warn about CW params when not using them 2019-07-20 21:40:32 +02:00
mac802154
mpls proc/sysctl: add shared variables for range check 2019-07-18 17:08:07 -07:00
ncsi
netfilter net: flow_offload: add flow_block structure and use it 2019-07-19 21:27:45 -07:00
netlabel
netlink
netrom
nfc nfc: fix potential illegal memory access 2019-07-08 12:46:24 -07:00
nsh
openvswitch net: openvswitch: rename flow_stats to sw_flow_stats 2019-07-19 21:27:45 -07:00
packet
phonet
psample
qrtr
rds Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-07-19 10:06:06 -07:00
rfkill
rose
rxrpc proc/sysctl: add shared variables for range check 2019-07-18 17:08:07 -07:00
sched net: sched: verify that q!=NULL before setting q->flags 2019-07-21 11:49:53 -07:00
sctp Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-07-19 10:06:06 -07:00
smc
strparser
sunrpc Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-07-19 10:42:02 -07:00
switchdev
tipc tipc: Fix a typo 2019-07-21 11:41:01 -07:00
tls net/tls: fix socket wmem accounting on fallback with netem 2019-07-08 20:21:10 -07:00
unix
vmw_vsock vsock/virtio: fix flush of works during the .remove() 2019-07-08 15:35:17 -07:00
wimax
wireless pci-v5.3-changes 2019-07-15 20:44:49 -07:00
x25
xdp xdp: fix potential deadlock on socket mutex 2019-07-12 15:02:21 +02:00
xfrm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-07-08 19:48:57 -07:00
compat.c
Kconfig
Makefile
socket.c Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-07-19 10:42:02 -07:00
sysctl_net.c