[RHEL7,COMMIT] rh/tcp: refine memory limit test in tcp_fragment()

Submitted by Konstantin Khorenko on Aug. 15, 2019, 3:46 p.m.

Details

Message ID 201908151546.x7FFk2R7020675@finist-ce7.sw.ru
State New
Headers show

Patch hide | download patch | download mbox

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 48fa7fa40370..deb3e4826639 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1129,8 +1129,9 @@  int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue,
 	if (nsize < 0)
 		nsize = 0;
 
-	if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf) ||
-	    skb_queue_len(&sk->sk_write_queue) > 2048) {
+	if (unlikely(((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf &&
+	    tcp_queue != TCP_FRAG_IN_WRITE_QUEUE) ||
+	    skb_queue_len(&sk->sk_write_queue) > 2048)) {
 		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPWQUEUETOOBIG);
 		return -ENOMEM;
 	}