]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: fix information leakage in /proc/net/ptype
authorCongyu Liu <liu3101@purdue.edu>
Tue, 18 Jan 2022 19:20:13 +0000 (14:20 -0500)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 3 Feb 2022 09:28:50 +0000 (10:28 +0100)
commitc765082fbd4f5acd63b20d76db686c14d192e5ab
tree263049e57b31e9eb3c40b6af65e24701dae50b41
parent4368ff27f3c41ae1d9546d9d2ce7ec6b195a970a
net: fix information leakage in /proc/net/ptype

BugLink: https://bugs.launchpad.net/bugs/1959879
commit 47934e06b65637c88a762d9c98329ae6e3238888 upstream.

In one net namespace, after creating a packet socket without binding
it to a device, users in other net namespaces can observe the new
`packet_type` added by this packet socket by reading `/proc/net/ptype`
file. This is minor information leakage as packet socket is
namespace aware.

Add a net pointer in `packet_type` to keep the net namespace of
of corresponding packet socket. In `ptype_seq_show`, this net pointer
must be checked when it is not NULL.

Fixes: 2feb27dbe00c ("[NETNS]: Minor information leak via /proc/net/ptype file.")
Signed-off-by: Congyu Liu <liu3101@purdue.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
include/linux/netdevice.h
net/core/net-procfs.c
net/packet/af_packet.c