Message ID | 20210213142634.3237642-1-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 39354eb29f597aa01b3d51ccc8169cf183c4367f |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] tcp: tcp_data_ready() must look at SOCK_DONE | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 2 maintainers not CCed: dsahern@kernel.org yoshfuji@linux-ipv6.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 2 this patch: 2 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 2 this patch: 2 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Sat, Feb 13, 2021 at 6:26 AM Eric Dumazet <eric.dumazet@gmail.com> wrote: > > From: Eric Dumazet <edumazet@google.com> > > 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> > --- Thanks Eric for the fix! Reviewed-by: Wei Wang <weiwan@google.com> > net/ipv4/tcp_input.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index e32a7056cb7640c67ef2d6a4d9484684d2602fcd..69a545db80d2ead47ffcf2f3819a6d066e95f35d 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -4924,7 +4924,7 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) > > 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); > } > > -- > 2.30.0.478.g8a0d178c01-goog >
Hello: This patch was applied to netdev/net-next.git (refs/heads/master): On Sat, 13 Feb 2021 06:26:34 -0800 you wrote: > From: Eric Dumazet <edumazet@google.com> > > 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 > > [...] Here is the summary with links: - [net-next] tcp: tcp_data_ready() must look at SOCK_DONE https://git.kernel.org/netdev/net-next/c/39354eb29f59 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e32a7056cb7640c67ef2d6a4d9484684d2602fcd..69a545db80d2ead47ffcf2f3819a6d066e95f35d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4924,7 +4924,7 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) 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); }