]> git.hungrycats.org Git - linux/commitdiff
[TCP]: Fix bug that hid sockets in tcp_diag
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 5 Oct 2004 15:01:33 +0000 (08:01 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Tue, 5 Oct 2004 15:01:33 +0000 (08:01 -0700)
This patch squashes a bug in tcp_diag which was created when the
sk_* loops replaced the original for loops.  It's a pity that these
sk_*/hlist_*/list_* loops don't take an arbitrary expression as an
argument for continue.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_diag.c

index 4ffb999d71834f14ae74cb78ffed98da84efe3e8..3e23c6de53f57b4554c8ddb67b340b346a721ff0 100644 (file)
@@ -495,21 +495,22 @@ static int tcpdiag_dump(struct sk_buff *skb, struct netlink_callback *cb)
                        sk_for_each(sk, node, &tcp_listening_hash[i]) {
                                struct inet_opt *inet = inet_sk(sk);
                                if (num < s_num)
-                                       continue;
+                                       goto next_listen;
                                if (!(r->tcpdiag_states&TCPF_LISTEN) ||
                                    r->id.tcpdiag_dport)
-                                       continue;
+                                       goto next_listen;
                                if (r->id.tcpdiag_sport != inet->sport &&
                                    r->id.tcpdiag_sport)
-                                       continue;
+                                       goto next_listen;
                                if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
-                                       continue;
+                                       goto next_listen;
                                if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
                                                 NETLINK_CB(cb->skb).pid,
                                                 cb->nlh->nlmsg_seq) <= 0) {
                                        tcp_listen_unlock();
                                        goto done;
                                }
+next_listen:
                                ++num;
                        }
                }
@@ -537,22 +538,23 @@ skip_listen_ht:
                        struct inet_opt *inet = inet_sk(sk);
 
                        if (num < s_num)
-                               continue;
+                               goto next_normal;
                        if (!(r->tcpdiag_states & (1 << sk->sk_state)))
-                               continue;
+                               goto next_normal;
                        if (r->id.tcpdiag_sport != inet->sport &&
                            r->id.tcpdiag_sport)
-                               continue;
+                               goto next_normal;
                        if (r->id.tcpdiag_dport != inet->dport && r->id.tcpdiag_dport)
-                               continue;
+                               goto next_normal;
                        if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
-                               continue;
+                               goto next_normal;
                        if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
                                         NETLINK_CB(cb->skb).pid,
                                         cb->nlh->nlmsg_seq) <= 0) {
                                read_unlock_bh(&head->lock);
                                goto done;
                        }
+next_normal:
                        ++num;
                }
 
@@ -562,21 +564,22 @@ skip_listen_ht:
                                struct inet_opt *inet = inet_sk(sk);
 
                                if (num < s_num)
-                                       continue;
+                                       goto next_dying;
                                if (r->id.tcpdiag_sport != inet->sport &&
                                    r->id.tcpdiag_sport)
-                                       continue;
+                                       goto next_dying;
                                if (r->id.tcpdiag_dport != inet->dport &&
                                    r->id.tcpdiag_dport)
-                                       continue;
+                                       goto next_dying;
                                if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
-                                       continue;
+                                       goto next_dying;
                                if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
                                                 NETLINK_CB(cb->skb).pid,
                                                 cb->nlh->nlmsg_seq) <= 0) {
                                        read_unlock_bh(&head->lock);
                                        goto done;
                                }
+next_dying:
                                ++num;
                        }
                }