]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: limit sk_rcvlowat by the maximum receive buffer
authorSoheil Hassas Yeganeh <soheil@google.com>
Sat, 9 Jun 2018 02:47:10 +0000 (22:47 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 10 Jun 2018 21:12:50 +0000 (14:12 -0700)
commit0de6091d16bc075e1689ec274723217f485549d3
tree8638841a4e39647569a24e5021bfa45586c90a3b
parenta862f0422e860ca0c5ef86b85705bde0a8004408
tcp: limit sk_rcvlowat by the maximum receive buffer

The user-provided value to setsockopt(SO_RCVLOWAT) can be
larger than the maximum possible receive buffer. Such values
mute POLLIN signals on the socket which can stall progress
on the socket.

Limit the user-provided value to half of the maximum receive
buffer, i.e., half of sk_rcvbuf when the receive buffer size
is set by the user, or otherwise half of sysctl_tcp_rmem[2].

Fixes: 96ba1ba9c27a ("tcp: fix SO_RCVLOWAT and RCVBUF autotuning")
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c