diff options
author | Andrei Vagin <avagin@openvz.org> | 2017-10-25 20:16:42 +0300 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-01-01 23:51:59 +0300 |
commit | 910e39b965c4095c8c4b2142a6144e7c1422f87b (patch) | |
tree | 4b84ee61ad8fbd5d68c0921aed5dfe8a5b93c11a /net | |
parent | f9d9e2df98092ab83ba87e636be6cee6d974b18d (diff) | |
download | linux-910e39b965c4095c8c4b2142a6144e7c1422f87b.tar.xz |
net/unix: don't show information about sockets from other namespaces
commit 0f5da659d8f1810f44de14acf2c80cd6499623a0 upstream.
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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/unix/diag.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/unix/diag.c b/net/unix/diag.c index 27dd3dcb7739..83b90b62b736 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c @@ -256,6 +256,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb, err = -ENOENT; if (sk == NULL) goto out_nosk; + if (!net_eq(sock_net(sk), net)) + goto out; err = sock_diag_check_cookie(sk, req->udiag_cookie); if (err) |