Skip to content

Commit 93b12f2

Browse files
avagingregkh
authored andcommitted
net/unix: don't show information about sockets from other namespaces
[ Upstream commit 0f5da659d8f1810f44de14acf2c80cd6499623a0 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 84237c5 commit 93b12f2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/unix/diag.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
257257
err = -ENOENT;
258258
if (sk == NULL)
259259
goto out_nosk;
260+
if (!net_eq(sock_net(sk), net))
261+
goto out;
260262

261263
err = sock_diag_check_cookie(sk, req->udiag_cookie);
262264
if (err)

0 commit comments

Comments
 (0)