diff options
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 6ce9b490fad5..ff8bc95670ed 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5307,6 +5307,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5307 | { | 5307 | { |
5308 | struct sctp_bind_hashbucket *head; /* hash list */ | 5308 | struct sctp_bind_hashbucket *head; /* hash list */ |
5309 | struct sctp_bind_bucket *pp; /* hash list port iterator */ | 5309 | struct sctp_bind_bucket *pp; /* hash list port iterator */ |
5310 | struct hlist_node *node; | ||
5310 | unsigned short snum; | 5311 | unsigned short snum; |
5311 | int ret; | 5312 | int ret; |
5312 | 5313 | ||
@@ -5331,7 +5332,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5331 | index = sctp_phashfn(rover); | 5332 | index = sctp_phashfn(rover); |
5332 | head = &sctp_port_hashtable[index]; | 5333 | head = &sctp_port_hashtable[index]; |
5333 | sctp_spin_lock(&head->lock); | 5334 | sctp_spin_lock(&head->lock); |
5334 | for (pp = head->chain; pp; pp = pp->next) | 5335 | sctp_for_each_hentry(pp, node, &head->chain) |
5335 | if (pp->port == rover) | 5336 | if (pp->port == rover) |
5336 | goto next; | 5337 | goto next; |
5337 | break; | 5338 | break; |
@@ -5358,7 +5359,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5358 | */ | 5359 | */ |
5359 | head = &sctp_port_hashtable[sctp_phashfn(snum)]; | 5360 | head = &sctp_port_hashtable[sctp_phashfn(snum)]; |
5360 | sctp_spin_lock(&head->lock); | 5361 | sctp_spin_lock(&head->lock); |
5361 | for (pp = head->chain; pp; pp = pp->next) { | 5362 | sctp_for_each_hentry(pp, node, &head->chain) { |
5362 | if (pp->port == snum) | 5363 | if (pp->port == snum) |
5363 | goto pp_found; | 5364 | goto pp_found; |
5364 | } | 5365 | } |
@@ -5702,10 +5703,7 @@ static struct sctp_bind_bucket *sctp_bucket_create( | |||
5702 | pp->port = snum; | 5703 | pp->port = snum; |
5703 | pp->fastreuse = 0; | 5704 | pp->fastreuse = 0; |
5704 | INIT_HLIST_HEAD(&pp->owner); | 5705 | INIT_HLIST_HEAD(&pp->owner); |
5705 | if ((pp->next = head->chain) != NULL) | 5706 | hlist_add_head(&pp->node, &head->chain); |
5706 | pp->next->pprev = &pp->next; | ||
5707 | head->chain = pp; | ||
5708 | pp->pprev = &head->chain; | ||
5709 | } | 5707 | } |
5710 | return pp; | 5708 | return pp; |
5711 | } | 5709 | } |
@@ -5714,9 +5712,7 @@ static struct sctp_bind_bucket *sctp_bucket_create( | |||
5714 | static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) | 5712 | static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) |
5715 | { | 5713 | { |
5716 | if (pp && hlist_empty(&pp->owner)) { | 5714 | if (pp && hlist_empty(&pp->owner)) { |
5717 | if (pp->next) | 5715 | __hlist_del(&pp->node); |
5718 | pp->next->pprev = pp->pprev; | ||
5719 | *(pp->pprev) = pp->next; | ||
5720 | kmem_cache_free(sctp_bucket_cachep, pp); | 5716 | kmem_cache_free(sctp_bucket_cachep, pp); |
5721 | SCTP_DBG_OBJCNT_DEC(bind_bucket); | 5717 | SCTP_DBG_OBJCNT_DEC(bind_bucket); |
5722 | } | 5718 | } |