netns: Don't leak others' openreq-s in proc
authorPavel Emelyanov <xemul@parallels.com>
Mon, 22 Nov 2010 03:26:12 +0000 (03:26 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Nov 2010 06:57:48 +0000 (22:57 -0800)
The /proc/net/tcp leaks openreq sockets from other namespaces.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c

index 69ccbc1dde9cdfed2719e243fd6091cc9781a876..e13da6de1fc79e26dc6d03b671e1becf9e6c8754 100644 (file)
@@ -2043,7 +2043,9 @@ get_req:
        }
 get_sk:
        sk_nulls_for_each_from(sk, node) {
-               if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
+               if (!net_eq(sock_net(sk), net))
+                       continue;
+               if (sk->sk_family == st->family) {
                        cur = sk;
                        goto out;
                }