aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/inet_timewait_sock.h14
-rw-r--r--net/ipv4/inet_timewait_sock.c15
2 files changed, 16 insertions, 13 deletions
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index abaff0597270..67e925065aae 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -193,19 +193,7 @@ static inline __be32 inet_rcv_saddr(const struct sock *sk)
193 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; 193 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr;
194} 194}
195 195
196static inline void inet_twsk_put(struct inet_timewait_sock *tw) 196extern void inet_twsk_put(struct inet_timewait_sock *tw);
197{
198 if (atomic_dec_and_test(&tw->tw_refcnt)) {
199 struct module *owner = tw->tw_prot->owner;
200 twsk_destructor((struct sock *)tw);
201#ifdef SOCK_REFCNT_DEBUG
202 printk(KERN_DEBUG "%s timewait_sock %p released\n",
203 tw->tw_prot->name, tw);
204#endif
205 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
206 module_put(owner);
207 }
208}
209 197
210extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 198extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
211 const int state); 199 const int state);
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index d43e787031a4..1b7db4208969 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -48,6 +48,21 @@ static void __inet_twsk_kill(struct inet_timewait_sock *tw,
48 inet_twsk_put(tw); 48 inet_twsk_put(tw);
49} 49}
50 50
51void inet_twsk_put(struct inet_timewait_sock *tw)
52{
53 if (atomic_dec_and_test(&tw->tw_refcnt)) {
54 struct module *owner = tw->tw_prot->owner;
55 twsk_destructor((struct sock *)tw);
56#ifdef SOCK_REFCNT_DEBUG
57 printk(KERN_DEBUG "%s timewait_sock %p released\n",
58 tw->tw_prot->name, tw);
59#endif
60 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
61 module_put(owner);
62 }
63}
64EXPORT_SYMBOL_GPL(inet_twsk_put);
65
51/* 66/*
52 * Enter the time wait state. This is called with locally disabled BH. 67 * Enter the time wait state. This is called with locally disabled BH.
53 * Essentially we whip up a timewait bucket, copy the relevant info into it 68 * Essentially we whip up a timewait bucket, copy the relevant info into it