diff options
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 7801cceb2d1b..de5a41de191a 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -87,6 +87,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
87 | struct hlist_node *node; | 87 | struct hlist_node *node; |
88 | struct inet_bind_bucket *tb; | 88 | struct inet_bind_bucket *tb; |
89 | int ret; | 89 | int ret; |
90 | struct net *net = sk->sk_net; | ||
90 | 91 | ||
91 | local_bh_disable(); | 92 | local_bh_disable(); |
92 | if (!snum) { | 93 | if (!snum) { |
@@ -100,7 +101,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
100 | head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; | 101 | head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; |
101 | spin_lock(&head->lock); | 102 | spin_lock(&head->lock); |
102 | inet_bind_bucket_for_each(tb, node, &head->chain) | 103 | inet_bind_bucket_for_each(tb, node, &head->chain) |
103 | if (tb->port == rover) | 104 | if (tb->ib_net == net && tb->port == rover) |
104 | goto next; | 105 | goto next; |
105 | break; | 106 | break; |
106 | next: | 107 | next: |
@@ -127,7 +128,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
127 | head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)]; | 128 | head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)]; |
128 | spin_lock(&head->lock); | 129 | spin_lock(&head->lock); |
129 | inet_bind_bucket_for_each(tb, node, &head->chain) | 130 | inet_bind_bucket_for_each(tb, node, &head->chain) |
130 | if (tb->port == snum) | 131 | if (tb->ib_net == net && tb->port == snum) |
131 | goto tb_found; | 132 | goto tb_found; |
132 | } | 133 | } |
133 | tb = NULL; | 134 | tb = NULL; |
@@ -147,7 +148,8 @@ tb_found: | |||
147 | } | 148 | } |
148 | tb_not_found: | 149 | tb_not_found: |
149 | ret = 1; | 150 | ret = 1; |
150 | if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep, head, snum)) == NULL) | 151 | if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep, |
152 | net, head, snum)) == NULL) | ||
151 | goto fail_unlock; | 153 | goto fail_unlock; |
152 | if (hlist_empty(&tb->owners)) { | 154 | if (hlist_empty(&tb->owners)) { |
153 | if (sk->sk_reuse && sk->sk_state != TCP_LISTEN) | 155 | if (sk->sk_reuse && sk->sk_state != TCP_LISTEN) |