aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/request_sock.h5
-rw-r--r--include/net/sock.h2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/ipv4/inet_hashtables.c2
4 files changed, 10 insertions, 1 deletions
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index e255ecf8bb40..3275cf31f731 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -77,6 +77,11 @@ static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *op
77 return req; 77 return req;
78} 78}
79 79
80static inline struct request_sock *inet_reqsk(struct sock *sk)
81{
82 return (struct request_sock *)sk;
83}
84
80static inline void __reqsk_free(struct request_sock *req) 85static inline void __reqsk_free(struct request_sock *req)
81{ 86{
82 kmem_cache_free(req->rsk_ops->slab, req); 87 kmem_cache_free(req->rsk_ops->slab, req);
diff --git a/include/net/sock.h b/include/net/sock.h
index 9411c3421dd3..f10832ca2e90 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1625,7 +1625,7 @@ static inline void sock_put(struct sock *sk)
1625 sk_free(sk); 1625 sk_free(sk);
1626} 1626}
1627/* Generic version of sock_put(), dealing with all sockets 1627/* Generic version of sock_put(), dealing with all sockets
1628 * (TCP_TIMEWAIT, ESTABLISHED...) 1628 * (TCP_TIMEWAIT, TCP_NEW_SYN_RECV, ESTABLISHED...)
1629 */ 1629 */
1630void sock_gen_put(struct sock *sk); 1630void sock_gen_put(struct sock *sk);
1631 1631
diff --git a/net/core/sock.c b/net/core/sock.c
index 63d871a91b5c..4bc42efb3e40 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1668,6 +1668,8 @@ void sock_edemux(struct sk_buff *skb)
1668 1668
1669 if (sk->sk_state == TCP_TIME_WAIT) 1669 if (sk->sk_state == TCP_TIME_WAIT)
1670 inet_twsk_put(inet_twsk(sk)); 1670 inet_twsk_put(inet_twsk(sk));
1671 else if (sk->sk_state == TCP_NEW_SYN_RECV)
1672 reqsk_put(inet_reqsk(sk));
1671 else 1673 else
1672 sock_put(sk); 1674 sock_put(sk);
1673} 1675}
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index f6a12b97d12b..64401a2fdd33 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -262,6 +262,8 @@ void sock_gen_put(struct sock *sk)
262 262
263 if (sk->sk_state == TCP_TIME_WAIT) 263 if (sk->sk_state == TCP_TIME_WAIT)
264 inet_twsk_free(inet_twsk(sk)); 264 inet_twsk_free(inet_twsk(sk));
265 else if (sk->sk_state == TCP_NEW_SYN_RECV)
266 reqsk_free(inet_reqsk(sk));
265 else 267 else
266 sk_free(sk); 268 sk_free(sk);
267} 269}