inet: prepare sock_edemux() & sock_gen_put() for new SYN_RECV state
authorEric Dumazet <edumazet@google.com>
Thu, 12 Mar 2015 23:44:08 +0000 (16:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Mar 2015 02:58:13 +0000 (22:58 -0400)
sock_edemux() & sock_gen_put() should be ready to cope with request socks.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/request_sock.h
include/net/sock.h
net/core/sock.c
net/ipv4/inet_hashtables.c

index e255ecf8bb400322bfae55a3a09df71752f9a5b8..3275cf31f731897ff7dc8ed98285b5fa3c0e4898 100644 (file)
@@ -77,6 +77,11 @@ static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *op
        return req;
 }
 
+static inline struct request_sock *inet_reqsk(struct sock *sk)
+{
+       return (struct request_sock *)sk;
+}
+
 static inline void __reqsk_free(struct request_sock *req)
 {
        kmem_cache_free(req->rsk_ops->slab, req);
index 9411c3421dd3ec4c02c51275a223b41972eb7df1..f10832ca2e90a77b8dd0d340e567b12b981c96f2 100644 (file)
@@ -1625,7 +1625,7 @@ static inline void sock_put(struct sock *sk)
                sk_free(sk);
 }
 /* Generic version of sock_put(), dealing with all sockets
- * (TCP_TIMEWAIT, ESTABLISHED...)
+ * (TCP_TIMEWAIT, TCP_NEW_SYN_RECV, ESTABLISHED...)
  */
 void sock_gen_put(struct sock *sk);
 
index 63d871a91b5c1d37c6f81e35617390f0cc8251dd..4bc42efb3e40863b34ca39da0ccdf7927e648168 100644 (file)
@@ -1668,6 +1668,8 @@ void sock_edemux(struct sk_buff *skb)
 
        if (sk->sk_state == TCP_TIME_WAIT)
                inet_twsk_put(inet_twsk(sk));
+       else if (sk->sk_state == TCP_NEW_SYN_RECV)
+               reqsk_put(inet_reqsk(sk));
        else
                sock_put(sk);
 }
index f6a12b97d12ba41d6b6bc933e4cb3320d27274f4..64401a2fdd33c512e5be18a841e8d2072d7a724d 100644 (file)
@@ -262,6 +262,8 @@ void sock_gen_put(struct sock *sk)
 
        if (sk->sk_state == TCP_TIME_WAIT)
                inet_twsk_free(inet_twsk(sk));
+       else if (sk->sk_state == TCP_NEW_SYN_RECV)
+               reqsk_free(inet_reqsk(sk));
        else
                sk_free(sk);
 }