diff options
Diffstat (limited to 'net/ipv4/inet_hashtables.c')
-rw-r--r-- | net/ipv4/inet_hashtables.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index b93d40ff6ef4..db1e53a865c2 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -28,12 +28,14 @@ | |||
28 | * The bindhash mutex for snum's hash chain must be held here. | 28 | * The bindhash mutex for snum's hash chain must be held here. |
29 | */ | 29 | */ |
30 | struct inet_bind_bucket *inet_bind_bucket_create(struct kmem_cache *cachep, | 30 | struct inet_bind_bucket *inet_bind_bucket_create(struct kmem_cache *cachep, |
31 | struct net *net, | ||
31 | struct inet_bind_hashbucket *head, | 32 | struct inet_bind_hashbucket *head, |
32 | const unsigned short snum) | 33 | const unsigned short snum) |
33 | { | 34 | { |
34 | struct inet_bind_bucket *tb = kmem_cache_alloc(cachep, GFP_ATOMIC); | 35 | struct inet_bind_bucket *tb = kmem_cache_alloc(cachep, GFP_ATOMIC); |
35 | 36 | ||
36 | if (tb != NULL) { | 37 | if (tb != NULL) { |
38 | tb->ib_net = net; | ||
37 | tb->port = snum; | 39 | tb->port = snum; |
38 | tb->fastreuse = 0; | 40 | tb->fastreuse = 0; |
39 | INIT_HLIST_HEAD(&tb->owners); | 41 | INIT_HLIST_HEAD(&tb->owners); |
@@ -359,6 +361,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, | |||
359 | struct inet_bind_hashbucket *head; | 361 | struct inet_bind_hashbucket *head; |
360 | struct inet_bind_bucket *tb; | 362 | struct inet_bind_bucket *tb; |
361 | int ret; | 363 | int ret; |
364 | struct net *net = sk->sk_net; | ||
362 | 365 | ||
363 | if (!snum) { | 366 | if (!snum) { |
364 | int i, remaining, low, high, port; | 367 | int i, remaining, low, high, port; |
@@ -381,7 +384,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, | |||
381 | * unique enough. | 384 | * unique enough. |
382 | */ | 385 | */ |
383 | inet_bind_bucket_for_each(tb, node, &head->chain) { | 386 | inet_bind_bucket_for_each(tb, node, &head->chain) { |
384 | if (tb->port == port) { | 387 | if (tb->ib_net == net && tb->port == port) { |
385 | BUG_TRAP(!hlist_empty(&tb->owners)); | 388 | BUG_TRAP(!hlist_empty(&tb->owners)); |
386 | if (tb->fastreuse >= 0) | 389 | if (tb->fastreuse >= 0) |
387 | goto next_port; | 390 | goto next_port; |
@@ -392,7 +395,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, | |||
392 | } | 395 | } |
393 | } | 396 | } |
394 | 397 | ||
395 | tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, head, port); | 398 | tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, |
399 | net, head, port); | ||
396 | if (!tb) { | 400 | if (!tb) { |
397 | spin_unlock(&head->lock); | 401 | spin_unlock(&head->lock); |
398 | break; | 402 | break; |