]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sctp/ipv6.c
[SCTP]: Convert bind_addr_list locking to RCU
[linux-2.6-omap-h63xx.git] / net / sctp / ipv6.c
index e12fa0a91da4ffada8f50c71fcdd53e19a6aa6ba..670fd2740b890bb6f2aeef51ddc7b05c07e4e9d0 100644 (file)
@@ -302,9 +302,7 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
                              union sctp_addr *saddr)
 {
        struct sctp_bind_addr *bp;
-       rwlock_t *addr_lock;
        struct sctp_sockaddr_entry *laddr;
-       struct list_head *pos;
        sctp_scope_t scope;
        union sctp_addr *baddr = NULL;
        __u8 matchlen = 0;
@@ -324,14 +322,14 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
        scope = sctp_scope(daddr);
 
        bp = &asoc->base.bind_addr;
-       addr_lock = &asoc->base.addr_lock;
 
        /* Go through the bind address list and find the best source address
         * that matches the scope of the destination address.
         */
-       sctp_read_lock(addr_lock);
-       list_for_each(pos, &bp->address_list) {
-               laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
+       rcu_read_lock();
+       list_for_each_entry_rcu(laddr, &bp->address_list, list) {
+               if (!laddr->valid)
+                       continue;
                if ((laddr->use_as_src) &&
                    (laddr->a.sa.sa_family == AF_INET6) &&
                    (scope <= sctp_scope(&laddr->a))) {
@@ -353,7 +351,7 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
                       __FUNCTION__, asoc, NIP6(daddr->v6.sin6_addr));
        }
 
-       sctp_read_unlock(addr_lock);
+       rcu_read_unlock();
 }
 
 /* Make a copy of all potential local addresses. */