From d16b1e8a65cafd0e2359ec26c3db697b6bce6bae Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Fri, 9 Nov 2007 11:41:36 -0500 Subject: [PATCH] --- yaml --- r: 73591 b: refs/heads/master c: 123ed979eaa8de0dd2422862d247469eda0bd645 h: refs/heads/master i: 73589: ad2dde66eb5d1b0227e64aeee3621484f77e916d 73587: 15333da43b3b5882ed2d5c4a6c3071f1366cfff9 73583: 06415b9744f91bd964c70081f25dd2fa259ca843 v: v3 --- [refs] | 2 +- trunk/net/sctp/endpointola.c | 34 ++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 147ce26c0673..28c8fb98c8a9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 027f6e1ad32de32f9fe1c61d0f744e329e8acfd9 +refs/heads/master: 123ed979eaa8de0dd2422862d247469eda0bd645 diff --git a/trunk/net/sctp/endpointola.c b/trunk/net/sctp/endpointola.c index 2d2d81ef4a69..68f0556efcc6 100644 --- a/trunk/net/sctp/endpointola.c +++ b/trunk/net/sctp/endpointola.c @@ -328,24 +328,34 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc( const union sctp_addr *paddr, struct sctp_transport **transport) { + struct sctp_association *asoc = NULL; + struct sctp_transport *t = NULL; + struct sctp_hashbucket *head; + struct sctp_ep_common *epb; + int hash; int rport; - struct sctp_association *asoc; - struct list_head *pos; + *transport = NULL; rport = ntohs(paddr->v4.sin_port); - list_for_each(pos, &ep->asocs) { - asoc = list_entry(pos, struct sctp_association, asocs); - if (rport == asoc->peer.port) { - *transport = sctp_assoc_lookup_paddr(asoc, paddr); - - if (*transport) - return asoc; + hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport); + head = &sctp_assoc_hashtable[hash]; + read_lock(&head->lock); + for (epb = head->chain; epb; epb = epb->next) { + asoc = sctp_assoc(epb); + if (asoc->ep != ep || rport != asoc->peer.port) + goto next; + + t = sctp_assoc_lookup_paddr(asoc, paddr); + if (t) { + *transport = t; + break; } +next: + asoc = NULL; } - - *transport = NULL; - return NULL; + read_unlock(&head->lock); + return asoc; } /* Lookup association on an endpoint based on a peer address. BH-safe. */