mptcp: fix spurious wake-up on under memory pressure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Paolo Abeni <pabeni@xxxxxxxxxx>

commit e226d9259dc4f5d2c19e6682ad1356fa97cf38f4 upstream.

The wake-up condition currently implemented by mptcp_epollin_ready()
is wrong, as it could mark the MPTCP socket as readable even when
no data are present and the system is under memory pressure.

Explicitly check for some data being available in the receive queue.

Fixes: 5684ab1a0eff ("mptcp: give rcvlowat some love")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
Link: https://patch.msgid.link/20250113-net-mptcp-connect-st-flakes-v1-2-0d986ee7b1b6@xxxxxxxxxx
Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 net/mptcp/protocol.h |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -685,10 +685,15 @@ static inline u64 mptcp_data_avail(const
 
 static inline bool mptcp_epollin_ready(const struct sock *sk)
 {
+	u64 data_avail = mptcp_data_avail(mptcp_sk(sk));
+
+	if (!data_avail)
+		return false;
+
 	/* mptcp doesn't have to deal with small skbs in the receive queue,
-	 * at it can always coalesce them
+	 * as it can always coalesce them
 	 */
-	return (mptcp_data_avail(mptcp_sk(sk)) >= sk->sk_rcvlowat) ||
+	return (data_avail >= sk->sk_rcvlowat) ||
 	       (mem_cgroup_sockets_enabled && sk->sk_memcg &&
 		mem_cgroup_under_socket_pressure(sk->sk_memcg)) ||
 	       READ_ONCE(tcp_memory_pressure);


Patches currently in stable-queue which might be from pabeni@xxxxxxxxxx are

queue-6.6/vsock-virtio-cancel-close-work-in-the-destructor.patch
queue-6.6/mptcp-fix-spurious-wake-up-on-under-memory-pressure.patch
queue-6.6/net-mlx5e-fix-inversion-dependency-warning-while-ena.patch
queue-6.6/mptcp-be-sure-to-send-ack-when-mptcp-level-window-re-opens.patch
queue-6.6/vsock-prevent-null-ptr-deref-in-vsock_.patch
queue-6.6/net-mlx5-clear-port-select-structure-when-fail-to-cr.patch
queue-6.6/net-mlx5-fix-rdma-tx-steering-prio.patch
queue-6.6/gtp-destroy-device-along-with-udp-socket-s-netns-dis.patch
queue-6.6/net-mlx5e-always-start-ipsec-sequence-number-from-1.patch
queue-6.6/vsock-reset-socket-state-when-de-assigning-the-transport.patch
queue-6.6/vsock-virtio-discard-packets-if-the-transport-changes.patch
queue-6.6/selftests-mptcp-avoid-spurious-errors-on-disconnect.patch
queue-6.6/vsock-bpf-return-early-if-transport-is-not-assigned.patch
queue-6.6/gtp-use-for_each_netdev_rcu-in-gtp_genl_dump_pdp.patch
queue-6.6/net-mlx5e-rely-on-reqid-in-ipsec-tunnel-mode.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux