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: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> Conflicts: include/linux/netdevice.h [kabi macro lead to conflicts] Signed-off-by:
Dong Chenchen <dongchenchen2@huawei.com>
Loading
Please sign in to comment