Commit 48fe3459 authored by Congyu Liu's avatar Congyu Liu Committed by Dong Chenchen
Browse files

net: fix information leakage in /proc/net/ptype

stable inclusion
from stable-v4.19.228
commit b67ad6170c0ea87391bb253f35d1f78857736e54
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IA72F3
CVE: CVE-2022-48757

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b67ad6170c0ea87391bb253f35d1f78857736e54



--------------------------------

commit 47934e06 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: 2feb27db ("[NETNS]: Minor information leak via /proc/net/ptype file.")
Signed-off-by: default avatarCongyu Liu <liu3101@purdue.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Conflicts:
	include/linux/netdevice.h
[kabi macro lead to conflicts]
Signed-off-by: default avatarDong Chenchen <dongchenchen2@huawei.com>
parent 1202ff30
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment