aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/tcp.h4
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/tcp.c7
3 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index ae46df590629..67c789ae719c 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -574,6 +574,8 @@ static inline bool fastopen_cookie_present(struct tcp_fastopen_cookie *foc)
574 return foc->len != -1; 574 return foc->len != -1;
575} 575}
576 576
577extern void tcp_sock_destruct(struct sock *sk);
578
577static inline int fastopen_init_queue(struct sock *sk, int backlog) 579static inline int fastopen_init_queue(struct sock *sk, int backlog)
578{ 580{
579 struct request_sock_queue *queue = 581 struct request_sock_queue *queue =
@@ -585,6 +587,8 @@ static inline int fastopen_init_queue(struct sock *sk, int backlog)
585 sk->sk_allocation); 587 sk->sk_allocation);
586 if (queue->fastopenq == NULL) 588 if (queue->fastopenq == NULL)
587 return -ENOMEM; 589 return -ENOMEM;
590
591 sk->sk_destruct = tcp_sock_destruct;
588 spin_lock_init(&queue->fastopenq->lock); 592 spin_lock_init(&queue->fastopenq->lock);
589 } 593 }
590 queue->fastopenq->max_qlen = backlog; 594 queue->fastopenq->max_qlen = backlog;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 845372b025f6..766c59658563 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -149,8 +149,6 @@ void inet_sock_destruct(struct sock *sk)
149 pr_err("Attempt to release alive inet socket %p\n", sk); 149 pr_err("Attempt to release alive inet socket %p\n", sk);
150 return; 150 return;
151 } 151 }
152 if (sk->sk_protocol == IPPROTO_TCP)
153 kfree(inet_csk(sk)->icsk_accept_queue.fastopenq);
154 152
155 WARN_ON(atomic_read(&sk->sk_rmem_alloc)); 153 WARN_ON(atomic_read(&sk->sk_rmem_alloc));
156 WARN_ON(atomic_read(&sk->sk_wmem_alloc)); 154 WARN_ON(atomic_read(&sk->sk_wmem_alloc));
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index df83d744e380..7b1e940393cf 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2325,6 +2325,13 @@ int tcp_disconnect(struct sock *sk, int flags)
2325} 2325}
2326EXPORT_SYMBOL(tcp_disconnect); 2326EXPORT_SYMBOL(tcp_disconnect);
2327 2327
2328void tcp_sock_destruct(struct sock *sk)
2329{
2330 inet_sock_destruct(sk);
2331
2332 kfree(inet_csk(sk)->icsk_accept_queue.fastopenq);
2333}
2334
2328static inline bool tcp_can_repair_sock(const struct sock *sk) 2335static inline bool tcp_can_repair_sock(const struct sock *sk)
2329{ 2336{
2330 return capable(CAP_NET_ADMIN) && 2337 return capable(CAP_NET_ADMIN) &&