diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 5b63ae4ec61f4..4c10c938d94a9 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -739,6 +739,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) { int mss_now = 0, size_goal = 0, ret = 0; struct mptcp_sock *msk = mptcp_sk(sk); + struct page_frag *pfrag; struct socket *ssock; size_t copied = 0; struct sock *ssk; @@ -767,12 +768,15 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) return ret >= 0 ? ret + copied : (copied ? copied : ret); } + pfrag = sk_page_frag(sk); restart: mptcp_clean_una(sk); __mptcp_flush_join_list(msk); ssk = mptcp_subflow_get_send(msk); - while (!sk_stream_memory_free(sk) || !ssk) { + while (!sk_stream_memory_free(sk) || + !ssk || + !mptcp_page_frag_refill(ssk, pfrag)) { ret = sk_stream_wait_memory(sk, &timeo); if (ret) goto out; @@ -822,6 +826,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) if (!tx_ok) break; if (!sk_stream_memory_free(ssk) || + !mptcp_page_frag_refill(ssk, pfrag) || !mptcp_ext_cache_refill(msk)) { tcp_push(ssk, msg->msg_flags, mss_now, tcp_sk(ssk)->nonagle, size_goal);