net: sock_edemux() should take care of timewait sockets
authorEric Dumazet <edumazet@google.com>
Sun, 2 Sep 2012 23:57:18 +0000 (23:57 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Sep 2012 17:22:43 +0000 (13:22 -0400)
sock_edemux() can handle either a regular socket or a timewait socket

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

index 8f67ced8d6a808689255435dd412df132138af65..7f64467535d1ba657d042ec2dd7a5ef0322a7e97 100644 (file)
@@ -1523,7 +1523,12 @@ EXPORT_SYMBOL(sock_rfree);
 
 void sock_edemux(struct sk_buff *skb)
 {
-       sock_put(skb->sk);
+       struct sock *sk = skb->sk;
+
+       if (sk->sk_state == TCP_TIME_WAIT)
+               inet_twsk_put(inet_twsk(sk));
+       else
+               sock_put(sk);
 }
 EXPORT_SYMBOL(sock_edemux);