aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_hashtables.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/inet_hashtables.c')
-rw-r--r--net/ipv4/inet_hashtables.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index d94e962958a4..e8d29fe736d2 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -19,6 +19,7 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/wait.h> 20#include <linux/wait.h>
21 21
22#include <net/inet_connection_sock.h>
22#include <net/inet_hashtables.h> 23#include <net/inet_hashtables.h>
23 24
24/* 25/*
@@ -56,10 +57,9 @@ void inet_bind_bucket_destroy(kmem_cache_t *cachep, struct inet_bind_bucket *tb)
56void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, 57void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
57 const unsigned short snum) 58 const unsigned short snum)
58{ 59{
59 struct inet_sock *inet = inet_sk(sk); 60 inet_sk(sk)->num = snum;
60 inet->num = snum;
61 sk_add_bind_node(sk, &tb->owners); 61 sk_add_bind_node(sk, &tb->owners);
62 inet->bind_hash = tb; 62 inet_csk(sk)->icsk_bind_hash = tb;
63} 63}
64 64
65EXPORT_SYMBOL(inet_bind_hash); 65EXPORT_SYMBOL(inet_bind_hash);
@@ -69,16 +69,15 @@ EXPORT_SYMBOL(inet_bind_hash);
69 */ 69 */
70static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk) 70static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk)
71{ 71{
72 struct inet_sock *inet = inet_sk(sk); 72 const int bhash = inet_bhashfn(inet_sk(sk)->num, hashinfo->bhash_size);
73 const int bhash = inet_bhashfn(inet->num, hashinfo->bhash_size);
74 struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; 73 struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash];
75 struct inet_bind_bucket *tb; 74 struct inet_bind_bucket *tb;
76 75
77 spin_lock(&head->lock); 76 spin_lock(&head->lock);
78 tb = inet->bind_hash; 77 tb = inet_csk(sk)->icsk_bind_hash;
79 __sk_del_bind_node(sk); 78 __sk_del_bind_node(sk);
80 inet->bind_hash = NULL; 79 inet_csk(sk)->icsk_bind_hash = NULL;
81 inet->num = 0; 80 inet_sk(sk)->num = 0;
82 inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb); 81 inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb);
83 spin_unlock(&head->lock); 82 spin_unlock(&head->lock);
84} 83}