diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index b945c2b046c5ead5503505f250c3c67761b284ae..5c7ed147449c1b7ba029b12e033ad779a631460a 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1084,6 +1084,7 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) struct sockcm_cookie sockc; int flags, err, copied = 0; int mss_now = 0, size_goal, copied_syn = 0; + bool process_backlog = false; bool sg; long timeo; @@ -1167,9 +1168,10 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) if (!sk_stream_memory_free(sk)) goto wait_for_sndbuf; - if (sk_flush_backlog(sk)) + if (process_backlog && sk_flush_backlog(sk)) { + process_backlog = false; goto restart; - + } skb = sk_stream_alloc_skb(sk, select_size(sk, sg), sk->sk_allocation, @@ -1177,6 +1179,7 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) if (!skb) goto wait_for_memory; + process_backlog = true; /* * Check whether we can use HW checksum. */