[UDP]: Make full use of proto.h.udp_hash innovation.
[deliverable/linux.git] / net / ipv4 / tcp_ipv4.c
index f9b30dc3bd6cedf422467ff46520c582c328feba..1a47719a55ad87fe876f99470125ae626c2f6b15 100644 (file)
@@ -1920,6 +1920,14 @@ int tcp_v4_destroy_sock(struct sock *sk)
                sk->sk_sndmsg_page = NULL;
        }
 
+       if (tp->defer_tcp_accept.request) {
+               reqsk_free(tp->defer_tcp_accept.request);
+               sock_put(tp->defer_tcp_accept.listen_sk);
+               sock_put(sk);
+               tp->defer_tcp_accept.listen_sk = NULL;
+               tp->defer_tcp_accept.request = NULL;
+       }
+
        atomic_dec(&tcp_sockets_allocated);
 
        return 0;
@@ -2050,7 +2058,7 @@ static void *established_get_first(struct seq_file *seq)
                st->state = TCP_SEQ_STATE_TIME_WAIT;
                inet_twsk_for_each(tw, node,
                                   &tcp_hashinfo.ehash[st->bucket].twchain) {
-                       if (tw->tw_family != st->family &&
+                       if (tw->tw_family != st->family ||
                            tw->tw_net != net) {
                                continue;
                        }
@@ -2078,7 +2086,7 @@ static void *established_get_next(struct seq_file *seq, void *cur)
                tw = cur;
                tw = tw_next(tw);
 get_tw:
-               while (tw && tw->tw_family != st->family && tw->tw_net != net) {
+               while (tw && (tw->tw_family != st->family || tw->tw_net != net)) {
                        tw = tw_next(tw);
                }
                if (tw) {
@@ -2253,7 +2261,7 @@ static int tcp_seq_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
+int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
 {
        int rc = 0;
        struct proc_dir_entry *p;
@@ -2266,7 +2274,7 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
        afinfo->seq_fops->llseek        = seq_lseek;
        afinfo->seq_fops->release       = tcp_seq_release;
 
-       p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops);
+       p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
        if (p)
                p->data = afinfo;
        else
@@ -2274,11 +2282,11 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
        return rc;
 }
 
-void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo)
+void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
 {
        if (!afinfo)
                return;
-       proc_net_remove(&init_net, afinfo->name);
+       proc_net_remove(net, afinfo->name);
        memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
 }
 
@@ -2419,12 +2427,12 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = {
 
 int __init tcp4_proc_init(void)
 {
-       return tcp_proc_register(&tcp4_seq_afinfo);
+       return tcp_proc_register(&init_net, &tcp4_seq_afinfo);
 }
 
 void tcp4_proc_exit(void)
 {
-       tcp_proc_unregister(&tcp4_seq_afinfo);
+       tcp_proc_unregister(&init_net, &tcp4_seq_afinfo);
 }
 #endif /* CONFIG_PROC_FS */
 
@@ -2460,7 +2468,7 @@ struct proto tcp_prot = {
        .obj_size               = sizeof(struct tcp_sock),
        .twsk_prot              = &tcp_timewait_sock_ops,
        .rsk_prot               = &tcp_request_sock_ops,
-       .hashinfo               = &tcp_hashinfo,
+       .h.hashinfo             = &tcp_hashinfo,
 #ifdef CONFIG_COMPAT
        .compat_setsockopt      = compat_tcp_setsockopt,
        .compat_getsockopt      = compat_tcp_getsockopt,
This page took 0.02943 seconds and 5 git commands to generate.