diff options
| author | Eric Dumazet <edumazet@google.com> | 2021-02-13 06:26:34 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-27 11:04:11 +0100 |
| commit | 9cb3144045343e7e66cac55e517feec9c286d392 (patch) | |
| tree | 2fefb7f3a02e704a1234fe95c4707c5c0f463509 /net | |
| parent | 775d9a08c42e55b508ad4150d7d0fa7bf473dd4c (diff) | |
| download | linux-9cb3144045343e7e66cac55e517feec9c286d392.tar.gz linux-9cb3144045343e7e66cac55e517feec9c286d392.tar.bz2 linux-9cb3144045343e7e66cac55e517feec9c286d392.zip | |
tcp: tcp_data_ready() must look at SOCK_DONE
commit 39354eb29f597aa01b3d51ccc8169cf183c4367f upstream.
My prior cleanup missed that tcp_data_ready() has to look at SOCK_DONE.
Otherwise, an application using SO_RCVLOWAT will not get EPOLLIN event
if a FIN is received in the middle of expected payload.
The reason SOCK_DONE is not examined in tcp_epollin_ready()
is that tcp_poll() catches the FIN because tcp_fin()
is also setting RCV_SHUTDOWN into sk->sk_shutdown
Fixes: 05dc72aba364 ("tcp: factorize logic into tcp_epollin_ready()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Wei Wang <weiwan@google.com>
Cc: Arjun Roy <arjunroy@google.com>
Reviewed-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/tcp_input.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 318fdeb1deef..c874ed9484b5 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5028,7 +5028,7 @@ err: void tcp_data_ready(struct sock *sk) { - if (tcp_epollin_ready(sk, sk->sk_rcvlowat)) + if (tcp_epollin_ready(sk, sk->sk_rcvlowat) || sock_flag(sk, SOCK_DONE)) sk->sk_data_ready(sk); } |
