summaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@openvz.org>2017-10-25 13:16:42 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-25 21:05:59 -0400
commit0f5da659d8f1810f44de14acf2c80cd6499623a0 (patch)
tree03ee96f8ce933646840e243195cf69af8cf7575a /net/unix
parent3eb8feeb1708c7dbfd2e97df92a2a407c116606e (diff)
net/unix: don't show information about sockets from other namespaces
socket_diag shows information only about sockets from a namespace where a diag socket lives. But if we request information about one unix socket, the kernel don't check that its netns is matched with a diag socket namespace, so any user can get information about any unix socket in a system. This looks like a bug. v2: add a Fixes tag Fixes: 51d7cccf0723 ("net: make sock diag per-namespace") Signed-off-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/diag.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 4d9679701a6d..384c84e83462 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -257,6 +257,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
257 err = -ENOENT; 257 err = -ENOENT;
258 if (sk == NULL) 258 if (sk == NULL)
259 goto out_nosk; 259 goto out_nosk;
260 if (!net_eq(sock_net(sk), net))
261 goto out;
260 262
261 err = sock_diag_check_cookie(sk, req->udiag_cookie); 263 err = sock_diag_check_cookie(sk, req->udiag_cookie);
262 if (err) 264 if (err)