diff mbox series

[net] mptcp: free acked data before waiting for more memory

Message ID 20200825233105.15172-1-fw@strlen.de
State Accepted
Delegated to: David Miller
Headers show
Series [net] mptcp: free acked data before waiting for more memory | expand

Commit Message

Florian Westphal Aug. 25, 2020, 11:31 p.m. UTC
After subflow lock is dropped, more wmem might have been made available.

This fixes a deadlock in mptcp_connect.sh 'mmap' mode: wmem is exhausted.
But as the mptcp socket holds on to already-acked data (for retransmit)
no wakeup will occur.

Using 'goto restart' calls mptcp_clean_una(sk) which will free pages
that have been acked completely in the mean time.

Fixes: fb529e62d3f3 ("mptcp: break and restart in case mptcp sndbuf is full")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/mptcp/protocol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Miller Aug. 26, 2020, 10:49 p.m. UTC | #1
From: Florian Westphal <fw@strlen.de>
Date: Wed, 26 Aug 2020 01:31:05 +0200

> After subflow lock is dropped, more wmem might have been made available.
> 
> This fixes a deadlock in mptcp_connect.sh 'mmap' mode: wmem is exhausted.
> But as the mptcp socket holds on to already-acked data (for retransmit)
> no wakeup will occur.
> 
> Using 'goto restart' calls mptcp_clean_una(sk) which will free pages
> that have been acked completely in the mean time.
> 
> Fixes: fb529e62d3f3 ("mptcp: break and restart in case mptcp sndbuf is full")
> Signed-off-by: Florian Westphal <fw@strlen.de>

Applied and queued up for -stable, thanks.
diff mbox series

Patch

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 1aad411a0e46..8ccd4a151dcb 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -892,7 +892,6 @@  static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 		goto out;
 	}
 
-wait_for_sndbuf:
 	__mptcp_flush_join_list(msk);
 	ssk = mptcp_subflow_get_send(msk);
 	while (!sk_stream_memory_free(sk) ||
@@ -982,7 +981,7 @@  static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 				 */
 				mptcp_set_timeout(sk, ssk);
 				release_sock(ssk);
-				goto wait_for_sndbuf;
+				goto restart;
 			}
 		}
 	}