aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_connection_sock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r--net/ipv4/inet_connection_sock.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 11cb4979a465..7d1874be1df3 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -57,7 +57,6 @@ int inet_csk_bind_conflict(const struct sock *sk,
57 const struct inet_bind_bucket *tb, bool relax) 57 const struct inet_bind_bucket *tb, bool relax)
58{ 58{
59 struct sock *sk2; 59 struct sock *sk2;
60 struct hlist_node *node;
61 int reuse = sk->sk_reuse; 60 int reuse = sk->sk_reuse;
62 int reuseport = sk->sk_reuseport; 61 int reuseport = sk->sk_reuseport;
63 kuid_t uid = sock_i_uid((struct sock *)sk); 62 kuid_t uid = sock_i_uid((struct sock *)sk);
@@ -69,7 +68,7 @@ int inet_csk_bind_conflict(const struct sock *sk,
69 * one this bucket belongs to. 68 * one this bucket belongs to.
70 */ 69 */
71 70
72 sk_for_each_bound(sk2, node, &tb->owners) { 71 sk_for_each_bound(sk2, &tb->owners) {
73 if (sk != sk2 && 72 if (sk != sk2 &&
74 !inet_v6_ipv6only(sk2) && 73 !inet_v6_ipv6only(sk2) &&
75 (!sk->sk_bound_dev_if || 74 (!sk->sk_bound_dev_if ||
@@ -95,7 +94,7 @@ int inet_csk_bind_conflict(const struct sock *sk,
95 } 94 }
96 } 95 }
97 } 96 }
98 return node != NULL; 97 return sk2 != NULL;
99} 98}
100EXPORT_SYMBOL_GPL(inet_csk_bind_conflict); 99EXPORT_SYMBOL_GPL(inet_csk_bind_conflict);
101 100
@@ -106,7 +105,6 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
106{ 105{
107 struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; 106 struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo;
108 struct inet_bind_hashbucket *head; 107 struct inet_bind_hashbucket *head;
109 struct hlist_node *node;
110 struct inet_bind_bucket *tb; 108 struct inet_bind_bucket *tb;
111 int ret, attempts = 5; 109 int ret, attempts = 5;
112 struct net *net = sock_net(sk); 110 struct net *net = sock_net(sk);
@@ -129,7 +127,7 @@ again:
129 head = &hashinfo->bhash[inet_bhashfn(net, rover, 127 head = &hashinfo->bhash[inet_bhashfn(net, rover,
130 hashinfo->bhash_size)]; 128 hashinfo->bhash_size)];
131 spin_lock(&head->lock); 129 spin_lock(&head->lock);
132 inet_bind_bucket_for_each(tb, node, &head->chain) 130 inet_bind_bucket_for_each(tb, &head->chain)
133 if (net_eq(ib_net(tb), net) && tb->port == rover) { 131 if (net_eq(ib_net(tb), net) && tb->port == rover) {
134 if (((tb->fastreuse > 0 && 132 if (((tb->fastreuse > 0 &&
135 sk->sk_reuse && 133 sk->sk_reuse &&
@@ -183,7 +181,7 @@ have_snum:
183 head = &hashinfo->bhash[inet_bhashfn(net, snum, 181 head = &hashinfo->bhash[inet_bhashfn(net, snum,
184 hashinfo->bhash_size)]; 182 hashinfo->bhash_size)];
185 spin_lock(&head->lock); 183 spin_lock(&head->lock);
186 inet_bind_bucket_for_each(tb, node, &head->chain) 184 inet_bind_bucket_for_each(tb, &head->chain)
187 if (net_eq(ib_net(tb), net) && tb->port == snum) 185 if (net_eq(ib_net(tb), net) && tb->port == snum)
188 goto tb_found; 186 goto tb_found;
189 } 187 }