Commit 41b822c5 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

inet: prepare sock_edemux() & sock_gen_put() for new SYN_RECV state

sock_edemux() & sock_gen_put() should be ready to cope with request socks.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0159dfd3
...@@ -77,6 +77,11 @@ static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *op ...@@ -77,6 +77,11 @@ static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *op
return req; 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) static inline void __reqsk_free(struct request_sock *req)
{ {
kmem_cache_free(req->rsk_ops->slab, req); kmem_cache_free(req->rsk_ops->slab, req);
......
...@@ -1625,7 +1625,7 @@ static inline void sock_put(struct sock *sk) ...@@ -1625,7 +1625,7 @@ static inline void sock_put(struct sock *sk)
sk_free(sk); sk_free(sk);
} }
/* Generic version of sock_put(), dealing with all sockets /* 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); void sock_gen_put(struct sock *sk);
......
...@@ -1668,6 +1668,8 @@ void sock_edemux(struct sk_buff *skb) ...@@ -1668,6 +1668,8 @@ void sock_edemux(struct sk_buff *skb)
if (sk->sk_state == TCP_TIME_WAIT) if (sk->sk_state == TCP_TIME_WAIT)
inet_twsk_put(inet_twsk(sk)); inet_twsk_put(inet_twsk(sk));
else if (sk->sk_state == TCP_NEW_SYN_RECV)
reqsk_put(inet_reqsk(sk));
else else
sock_put(sk); sock_put(sk);
} }
......
...@@ -262,6 +262,8 @@ void sock_gen_put(struct sock *sk) ...@@ -262,6 +262,8 @@ void sock_gen_put(struct sock *sk)
if (sk->sk_state == TCP_TIME_WAIT) if (sk->sk_state == TCP_TIME_WAIT)
inet_twsk_free(inet_twsk(sk)); inet_twsk_free(inet_twsk(sk));
else if (sk->sk_state == TCP_NEW_SYN_RECV)
reqsk_free(inet_reqsk(sk));
else else
sk_free(sk); sk_free(sk);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment