summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Hunt <johunt@akamai.com>2015-03-20 02:19:30 +0300
committerJiri Slaby <jslaby@suse.cz>2015-04-09 14:13:47 +0300
commite5354126dfddb5721264c385777dd8b5ecf10855 (patch)
treee93f5583018d5d211c00098cdbd628c2ac54723a
parent7d5a6af313ac6c7a61657261f27bd72f547af306 (diff)
downloadlinux-e5354126dfddb5721264c385777dd8b5ecf10855.tar.xz
tcp: fix tcp fin memory accounting
[ Upstream commit d22e1537181188e5dc8cbc51451832625035bdc2 ] tcp_send_fin() does not account for the memory it allocates properly, so sk_forward_alloc can be negative in cases where we've sent a FIN: ss example output (ss -amn | grep -B1 f4294): tcp FIN-WAIT-1 0 1 192.168.0.1:45520 192.0.2.1:8080 skmem:(r0,rb87380,t0,tb87380,f4294966016,w1280,o0,bl0) Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--net/ipv4/tcp_output.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index b4435ae4c485..c3cfdad25629 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2603,15 +2603,11 @@ void tcp_send_fin(struct sock *sk)
} else {
/* Socket is locked, keep trying until memory is available. */
for (;;) {
- skb = alloc_skb_fclone(MAX_TCP_HEADER,
- sk->sk_allocation);
+ skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
if (skb)
break;
yield();
}
-
- /* Reserve space for headers and prepare control bits. */
- skb_reserve(skb, MAX_TCP_HEADER);
/* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
tcp_init_nondata_skb(skb, tp->write_seq,
TCPHDR_ACK | TCPHDR_FIN);