[PATCH net-next 6/7] tcp: use tcp_set_window_clamp() for SO_RCVLOWAT

From: Simon Baatz via B4 Relay

Date: Wed Apr 08 2026 - 17:54:25 EST


From: Simon Baatz <gmbnomis@xxxxxxxxx>

Setting the SO_RCVLOWAT socket option may raise the receive window
clamp. Currently this is done by assigning to window_clamp directly.

Use the tcp_set_window_clamp() helper instead, so that raising the
clamp is subject to the same constraints and rcv_ssthresh adjustments
as TCP_WINDOW_CLAMP.

Signed-off-by: Simon Baatz <gmbnomis@xxxxxxxxx>
---
net/ipv4/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index bd03c99f793ae..567027bc86b3f 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1853,7 +1853,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val)
WRITE_ONCE(sk->sk_rcvbuf, space);

if (tp->window_clamp && tp->window_clamp < val)
- WRITE_ONCE(tp->window_clamp, val);
+ tcp_set_window_clamp(sk, val);
}
return 0;
}

--
2.53.0