Skip to content

Commit 460ce23

Browse files
committed
tcp: refine memory limit test in tcp_fragment()
jira LE-1907 Rebuild_History Non-Buildable kernel-3.10.0-1062.el7 commit-author Eric Dumazet <edumazet@google.com> commit b6653b3 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-3.10.0-1062.el7/b6653b36.failed tcp_fragment() might be called for skbs in the write queue. Memory limits might have been exceeded because tcp_sendmsg() only checks limits at full skb (64KB) boundaries. Therefore, we need to make sure tcp_fragment() wont punish applications that might have setup very low SO_SNDBUF values. Fixes: f070ef2 ("tcp: tcp_fragment() should apply sane memory limits") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Christoph Paasch <cpaasch@apple.com> Tested-by: Christoph Paasch <cpaasch@apple.com> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit b6653b3) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # net/ipv4/tcp_output.c
1 parent 3361101 commit 460ce23

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
tcp: refine memory limit test in tcp_fragment()
2+
3+
jira LE-1907
4+
Rebuild_History Non-Buildable kernel-3.10.0-1062.el7
5+
commit-author Eric Dumazet <edumazet@google.com>
6+
commit b6653b3629e5b88202be3c9abc44713973f5c4b4
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-3.10.0-1062.el7/b6653b36.failed
10+
11+
tcp_fragment() might be called for skbs in the write queue.
12+
13+
Memory limits might have been exceeded because tcp_sendmsg() only
14+
checks limits at full skb (64KB) boundaries.
15+
16+
Therefore, we need to make sure tcp_fragment() wont punish applications
17+
that might have setup very low SO_SNDBUF values.
18+
19+
Fixes: f070ef2ac667 ("tcp: tcp_fragment() should apply sane memory limits")
20+
Signed-off-by: Eric Dumazet <edumazet@google.com>
21+
Reported-by: Christoph Paasch <cpaasch@apple.com>
22+
Tested-by: Christoph Paasch <cpaasch@apple.com>
23+
Signed-off-by: David S. Miller <davem@davemloft.net>
24+
(cherry picked from commit b6653b3629e5b88202be3c9abc44713973f5c4b4)
25+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
26+
27+
# Conflicts:
28+
# net/ipv4/tcp_output.c
29+
diff --cc net/ipv4/tcp_output.c
30+
index 52f0e3183733,0ebc33d1c9e5..000000000000
31+
--- a/net/ipv4/tcp_output.c
32+
+++ b/net/ipv4/tcp_output.c
33+
@@@ -1129,7 -1296,13 +1129,17 @@@ int tcp_fragment(struct sock *sk, struc
34+
if (nsize < 0)
35+
nsize = 0;
36+
37+
++<<<<<<< HEAD
38+
+ if (skb_unclone(skb, GFP_ATOMIC))
39+
++=======
40+
+ if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf &&
41+
+ tcp_queue != TCP_FRAG_IN_WRITE_QUEUE)) {
42+
+ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPWQUEUETOOBIG);
43+
+ return -ENOMEM;
44+
+ }
45+
+
46+
+ if (skb_unclone(skb, gfp))
47+
++>>>>>>> b6653b3629e5 (tcp: refine memory limit test in tcp_fragment())
48+
return -ENOMEM;
49+
50+
/* Get a new skb... force flag on. */
51+
* Unmerged path net/ipv4/tcp_output.c

0 commit comments

Comments
 (0)