MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH] Squash-to: "mptcp: wake-up readers only for in sequence data"
@ 2021-06-07 14:08 Paolo Abeni
  2021-06-07 14:57 ` Matthieu Baerts
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2021-06-07 14:08 UTC (permalink / raw)
  To: mptcp; +Cc: Matthieu Baerts

We need to flip the DATA_READY bit under the mptcp_data_lock()
(or before acquiring it, as the old code did), or the BH could
end-up flipping the bit after that the user-space already
flushed the just-appended data.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 8e7cf4c480a6..8ef60e415d9a 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -687,8 +687,6 @@ static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk)
 	if (inet_sk_state_load(sk) == TCP_CLOSE)
 		return false;
 
-	mptcp_data_lock(sk);
-
 	__mptcp_move_skbs_from_subflow(msk, ssk, &moved);
 	__mptcp_ofo_queue(msk);
 	if (unlikely(ssk->sk_err)) {
@@ -705,8 +703,6 @@ static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk)
 	 */
 	if (mptcp_pending_data_fin(sk, NULL))
 		mptcp_schedule_work(sk);
-	mptcp_data_unlock(sk);
-
 	return moved > 0;
 }
 
@@ -733,10 +729,12 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
 		return;
 
 	/* Wake-up the reader only for in-sequence data */
+	mptcp_data_lock(sk);
 	if (move_skbs_to_msk(msk, ssk)) {
 		set_bit(MPTCP_DATA_READY, &msk->flags);
 		sk->sk_data_ready(sk);
 	}
+	mptcp_data_unlock(sk);
 }
 
 static bool mptcp_do_flush_join_list(struct mptcp_sock *msk)
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-07 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-07 14:08 [PATCH] Squash-to: "mptcp: wake-up readers only for in sequence data" Paolo Abeni
2021-06-07 14:57 ` Matthieu Baerts
2021-06-07 16:45   ` Mat Martineau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox