Skip to content

Commit

Permalink
net/unix: don't show information about sockets from other namespaces
Browse files Browse the repository at this point in the history
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: 51d7ccc ("net: make sock diag per-namespace")
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
avagin authored and davem330 committed Oct 26, 2017
1 parent 3eb8fee commit 0f5da65
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/unix/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,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)
Expand Down

0 comments on commit 0f5da65

Please sign in to comment.