Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv4: Don't add TCP-code in inet_sock_destruct

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Acked-by: H.K. Jerry Chu <hkchu@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Christoph Paasch and committed by
David S. Miller
bb68b647 9baa0b03

+11 -2
+4
include/linux/tcp.h
··· 574 574 return foc->len != -1; 575 575 } 576 576 577 + extern void tcp_sock_destruct(struct sock *sk); 578 + 577 579 static inline int fastopen_init_queue(struct sock *sk, int backlog) 578 580 { 579 581 struct request_sock_queue *queue = ··· 587 585 sk->sk_allocation); 588 586 if (queue->fastopenq == NULL) 589 587 return -ENOMEM; 588 + 589 + sk->sk_destruct = tcp_sock_destruct; 590 590 spin_lock_init(&queue->fastopenq->lock); 591 591 } 592 592 queue->fastopenq->max_qlen = backlog;
-2
net/ipv4/af_inet.c
··· 149 149 pr_err("Attempt to release alive inet socket %p\n", sk); 150 150 return; 151 151 } 152 - if (sk->sk_protocol == IPPROTO_TCP) 153 - kfree(inet_csk(sk)->icsk_accept_queue.fastopenq); 154 152 155 153 WARN_ON(atomic_read(&sk->sk_rmem_alloc)); 156 154 WARN_ON(atomic_read(&sk->sk_wmem_alloc));
+7
net/ipv4/tcp.c
··· 2325 2325 } 2326 2326 EXPORT_SYMBOL(tcp_disconnect); 2327 2327 2328 + void tcp_sock_destruct(struct sock *sk) 2329 + { 2330 + inet_sock_destruct(sk); 2331 + 2332 + kfree(inet_csk(sk)->icsk_accept_queue.fastopenq); 2333 + } 2334 + 2328 2335 static inline bool tcp_can_repair_sock(const struct sock *sk) 2329 2336 { 2330 2337 return capable(CAP_NET_ADMIN) &&