FROMGIT: tcp: refine memory limit test in tcp_fragment()

commit b6653b3629e5b88202be3c9abc44713973f5c4b4 upstream.

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: f070ef2ac667 ("tcp: tcp_fragment() should apply sane memory limits")
Signed-off-by: Eric Dumazet <>
Reported-by: Christoph Paasch <>
Tested-by: Christoph Paasch <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
(cherry picked from commit 1bc13903773bc9418a8f898c462eef64b7fa1d52
 git:// linux-4.14.y)
Signed-off-by: Robert Kolchmeyer <>

TEST=build and run

Change-Id: Idea013a08b345bcb70873d3ba74842436b0c7a14
Reviewed-by: Sean Paul <>
Reviewed-by: Guenter Roeck <>
Commit-Queue: Guenter Roeck <>
Tested-by: Guenter Roeck <>
1 file changed