summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2019-08-11 15:41:31 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2019-08-11 15:41:31 +0200
commit74c82193e89daaa486f49dc8a4f8ed38f0460159 (patch)
tree78bfe03cd39cd778d95e1215d8e53a53ff4ebb44 /net/ipv4/tcp_output.c
parent89a387f7fc8079d8938c0632b75769b5622ac16b (diff)
parent3904234bd04fa7c40467e5d8b3301893fae16e87 (diff)
Merge 4.4.189 into android-4.4
Changes in 4.4.189 arm64: cpufeature: Fix CTR_EL0 field definitions arm64: cpufeature: Fix feature comparison for CTR_EL0.{CWG,ERG} netfilter: nfnetlink_acct: validate NFACCT_QUOTA parameter HID: Add quirk for HP X1200 PIXART OEM mouse tcp: be more careful in tcp_fragment() atm: iphase: Fix Spectre v1 vulnerability net: bridge: delete local fdb on device init failure net: fix ifindex collision during namespace removal tipc: compat: allow tipc commands without arguments net: sched: Fix a possible null-pointer dereference in dequeue_func() net/mlx5: Use reversed order when unregister devices bnx2x: Disable multi-cos feature. compat_ioctl: pppoe: fix PPPOEIOCSFWD handling block: blk_init_allocated_queue() set q->fq as NULL in the fail case spi: bcm2835: Fix 3-wire mode if DMA is enabled x86: cpufeatures: Sort feature word 7 x86/entry/64: Fix context tracking state warning when load_gs_index fails x86/speculation: Prepare entry code for Spectre v1 swapgs mitigations x86/speculation: Enable Spectre v1 swapgs mitigations x86/entry/64: Use JMP instead of JMPQ x86/speculation/swapgs: Exclude ATOMs from speculation through SWAPGS Linux 4.4.189 Change-Id: I3d4e7965c8f5547ab025236686ea0d60e0b6e1f4 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index c4f790251a7b..e65c211d3f4b 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1151,6 +1151,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *buff;
int nsize, old_factor;
+ long limit;
int nlen;
u8 flags;
@@ -1161,7 +1162,15 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
if (nsize < 0)
nsize = 0;
- if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf + 0x20000)) {
+ /* tcp_sendmsg() can overshoot sk_wmem_queued by one full size skb.
+ * We need some allowance to not penalize applications setting small
+ * SO_SNDBUF values.
+ * Also allow first and last skb in retransmit queue to be split.
+ */
+ limit = sk->sk_sndbuf + 2 * SKB_TRUESIZE(GSO_MAX_SIZE);
+ if (unlikely((sk->sk_wmem_queued >> 1) > limit &&
+ skb != tcp_rtx_queue_head(sk) &&
+ skb != tcp_rtx_queue_tail(sk))) {
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPWQUEUETOOBIG);
return -ENOMEM;
}