diff options
| author | Cong Wang <[email protected]> | 2022-08-17 19:54:45 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2022-08-18 18:04:56 +0000 |
| commit | 2e23acd99efacfd2a63cb9725afbc65e4e964fb7 (patch) | |
| tree | 7378084ad03e9513090482684a21c6e810d61b36 /net/ipv4/tcp.c | |
| parent | tcp: refactor tcp_read_skb() a bit (diff) | |
| download | kernel-2e23acd99efacfd2a63cb9725afbc65e4e964fb7.tar.gz kernel-2e23acd99efacfd2a63cb9725afbc65e4e964fb7.zip | |
tcp: handle pure FIN case correctly
When skb->len==0, the recv_actor() returns 0 too, but we also use 0
for error conditions. This patch amends this by propagating the errors
to tcp_read_skb() so that we can distinguish skb->len==0 case from
error cases.
Fixes: 04919bed948d ("tcp: Introduce tcp_read_skb()")
Reported-by: Eric Dumazet <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: Jakub Sitnicki <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/ipv4/tcp.c')
| -rw-r--r-- | net/ipv4/tcp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 56a554b49caa..bbe218753662 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1768,7 +1768,7 @@ int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor) __skb_unlink(skb, &sk->sk_receive_queue); WARN_ON(!skb_set_owner_sk_safe(skb, sk)); copied = recv_actor(sk, skb); - if (copied > 0) { + if (copied >= 0) { seq += copied; if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) ++seq; |
