Skip to content

Commit

Permalink
Revert "tcp: remove redundant check on tskb"
Browse files Browse the repository at this point in the history
This reverts commit 22dc505.

Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Vegard Nossum <[email protected]>
  • Loading branch information
vegard committed Aug 8, 2024
1 parent 378cd84 commit 2e31c6f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -3127,6 +3127,7 @@ void tcp_send_fin(struct sock *sk)
* as TCP stack thinks it has already been transmitted.
*/
if (tskb && (tcp_send_head(sk) || tcp_under_memory_pressure(sk))) {
coalesce:
TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN;
TCP_SKB_CB(tskb)->end_seq++;
tp->write_seq++;
Expand All @@ -3142,9 +3143,11 @@ void tcp_send_fin(struct sock *sk)
}
} else {
skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation);
if (unlikely(!skb))
if (unlikely(!skb)) {
if (tskb)
goto coalesce;
return;

}
skb_reserve(skb, MAX_TCP_HEADER);
sk_forced_mem_schedule(sk, skb->truesize);
/* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
Expand Down

0 comments on commit 2e31c6f

Please sign in to comment.