Skip to content

Commit 39354eb

Browse files
Eric Dumazetdavem330
authored andcommitted
tcp: tcp_data_ready() must look at SOCK_DONE
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: 05dc72a ("tcp: factorize logic into tcp_epollin_ready()") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Wei Wang <[email protected]> Cc: Arjun Roy <[email protected]> Reviewed-by: Wei Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ca04422 commit 39354eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4924,7 +4924,7 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
49244924

49254925
void tcp_data_ready(struct sock *sk)
49264926
{
4927-
if (tcp_epollin_ready(sk, sk->sk_rcvlowat))
4927+
if (tcp_epollin_ready(sk, sk->sk_rcvlowat) || sock_flag(sk, SOCK_DONE))
49284928
sk->sk_data_ready(sk);
49294929
}
49304930

0 commit comments

Comments
 (0)