diff options
author | Eric Dumazet <edumazet@google.com> | 2021-11-15 20:02:47 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-11-16 14:10:35 +0100 |
commit | 8bd172b787298124ef75c0e466101107c036d54d (patch) | |
tree | 6d6757ee44e509a9afa4f9187f8612a5ae850caa /net/ipv4/tcp.c | |
parent | tcp: defer skb freeing after socket lock is released (diff) | |
download | linux-8bd172b787298124ef75c0e466101107c036d54d.tar.xz linux-8bd172b787298124ef75c0e466101107c036d54d.zip |
tcp: check local var (timeo) before socket fields in one test
Testing timeo before sk_err/sk_state/sk_shutdown makes more sense.
Modern applications use non-blocking IO, while a socket is terminated
only once during its life time.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 33cd9a1c199c..7b1886103556 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2399,10 +2399,10 @@ static int tcp_recvmsg_locked(struct sock *sk, struct msghdr *msg, size_t len, break; if (copied) { - if (sk->sk_err || + if (!timeo || + sk->sk_err || sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN) || - !timeo || signal_pending(current)) break; } else { |