]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/inet6_hashtables.c
net: convert BUG_TRAP to generic WARN_ON
[linux-2.6-omap-h63xx.git] / net / ipv6 / inet6_hashtables.c
index 340c7d42b83a17f89739bed374d4b6955c0b3d69..1646a565825513421332b02411f00aa863f9c261 100644 (file)
@@ -28,7 +28,7 @@ void __inet6_hash(struct sock *sk)
        struct hlist_head *list;
        rwlock_t *lock;
 
-       BUG_TRAP(sk_unhashed(sk));
+       WARN_ON(!sk_unhashed(sk));
 
        if (sk->sk_state == TCP_LISTEN) {
                list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
@@ -43,7 +43,7 @@ void __inet6_hash(struct sock *sk)
        }
 
        __sk_add_node(sk, list);
-       sock_prot_inuse_add(sk->sk_prot, 1);
+       sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
        write_unlock(lock);
 }
 EXPORT_SYMBOL(__inet6_hash);
@@ -68,7 +68,7 @@ struct sock *__inet6_lookup_established(struct net *net,
        /* Optimize here for direct hit, only listening connections can
         * have wildcards anyways.
         */
-       unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport);
+       unsigned int hash = inet6_ehashfn(net, daddr, hnum, saddr, sport);
        struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
        rwlock_t *lock = inet_ehash_lockp(hashinfo, hash);
 
@@ -104,7 +104,8 @@ struct sock *inet6_lookup_listener(struct net *net,
        int score, hiscore = 0;
 
        read_lock(&hashinfo->lhash_lock);
-       sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) {
+       sk_for_each(sk, node,
+                       &hashinfo->listening_hash[inet_lhashfn(net, hnum)]) {
                if (net_eq(sock_net(sk), net) && inet_sk(sk)->num == hnum &&
                                sk->sk_family == PF_INET6) {
                        const struct ipv6_pinfo *np = inet6_sk(sk);
@@ -165,14 +166,14 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
        const struct in6_addr *saddr = &np->daddr;
        const int dif = sk->sk_bound_dev_if;
        const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport);
-       const unsigned int hash = inet6_ehashfn(daddr, lport, saddr,
+       struct net *net = sock_net(sk);
+       const unsigned int hash = inet6_ehashfn(net, daddr, lport, saddr,
                                                inet->dport);
        struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash);
        rwlock_t *lock = inet_ehash_lockp(hinfo, hash);
        struct sock *sk2;
        const struct hlist_node *node;
        struct inet_timewait_sock *tw;
-       struct net *net = sock_net(sk);
 
        prefetch(head->chain.first);
        write_lock(lock);
@@ -201,19 +202,19 @@ unique:
         * in hash table socket with a funny identity. */
        inet->num = lport;
        inet->sport = htons(lport);
-       BUG_TRAP(sk_unhashed(sk));
+       WARN_ON(!sk_unhashed(sk));
        __sk_add_node(sk, &head->chain);
        sk->sk_hash = hash;
-       sock_prot_inuse_add(sk->sk_prot, 1);
+       sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
        write_unlock(lock);
 
        if (twp != NULL) {
                *twp = tw;
-               NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED);
+               NET_INC_STATS_BH(twsk_net(tw), LINUX_MIB_TIMEWAITRECYCLED);
        } else if (tw != NULL) {
                /* Silly. Should hash-dance instead... */
                inet_twsk_deschedule(tw, death_row);
-               NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED);
+               NET_INC_STATS_BH(twsk_net(tw), LINUX_MIB_TIMEWAITRECYCLED);
 
                inet_twsk_put(tw);
        }