lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEA6p_AUsnEW4BacV1uW_own6QJaMSGiDjX1Up0j8J5rzY9s0A@mail.gmail.com>
Date:   Sun, 14 Feb 2021 10:34:15 -0800
From:   Wei Wang <weiwan@...gle.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netdev <netdev@...r.kernel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Arjun Roy <arjunroy@...gle.com>
Subject: Re: [PATCH net-next] tcp: tcp_data_ready() must look at SOCK_DONE

On Sat, Feb 13, 2021 at 6:26 AM Eric Dumazet <eric.dumazet@...il.com> wrote:
>
> From: Eric Dumazet <edumazet@...gle.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@...gle.com>
> Reported-by: Wei Wang <weiwan@...gle.com>
> Cc: Arjun Roy <arjunroy@...gle.com>
> ---
Thanks Eric for the fix!

Reviewed-by: Wei Wang <weiwan@...gle.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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ