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 <[email protected]>
Reported-by: Christoph Paasch <[email protected]>
Tested-by: Christoph Paasch <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 1bc13903773bc9418a8f898c462eef64b7fa1d52
 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.14.y)
Signed-off-by: Robert Kolchmeyer <[email protected]>

BUG=b:136039896
TEST=build and run

Change-Id: Idea013a08b345bcb70873d3ba74842436b0c7a14
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1681404
Reviewed-by: Sean Paul <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Commit-Queue: Guenter Roeck <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
1 file changed