Congyu Liu be1ca30331 net: fix information leakage in /proc/net/ptype
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>
2022-02-08 18:15:27 +01:00
..
2016-10-12 11:01:37 -07:00
2016-09-14 20:37:50 +02:00
2016-08-25 11:26:48 -04:00
2017-10-08 10:26:06 +02:00
2016-09-14 09:18:06 -06:00
2018-02-28 10:18:33 +01:00
2017-05-14 14:00:22 +02:00
2019-11-25 09:53:14 +01:00
2017-07-12 15:01:02 +02:00
2021-12-08 08:45:06 +01:00
2021-12-08 08:45:06 +01:00
2017-08-06 18:59:43 -07:00
2021-02-03 23:19:50 +01:00
2016-09-24 10:48:18 +02:00
2021-03-30 14:41:41 +02:00
2016-10-20 15:51:28 +11:00
2016-09-16 09:34:15 +01:00
2016-09-14 09:18:09 -06:00
2018-10-10 08:53:18 +02:00
2016-08-10 11:23:44 -04:00
2020-04-02 17:20:40 +02:00
2016-09-15 16:49:39 +02:00
2021-11-26 11:48:18 +01:00
2016-09-27 12:33:47 +02:00
2017-08-24 17:12:19 -07:00
2022-01-27 08:47:43 +01:00
2021-07-11 12:46:40 +02:00
2016-10-19 11:36:22 -06:00
2020-11-18 18:26:29 +01:00
2020-03-20 09:07:43 +01:00
2017-08-24 17:12:21 -07:00
2016-10-14 11:36:59 -07:00
2016-09-27 21:52:00 -04:00
2016-09-08 15:01:10 -07:00
2016-09-08 22:15:25 -07:00
2020-04-02 17:20:39 +02:00
2017-08-30 10:21:40 +02:00
2016-08-28 23:44:55 -04:00
2016-10-05 18:23:36 -04:00
2018-11-13 11:17:02 -08:00
2020-12-11 13:38:00 +01:00
2017-04-21 09:31:21 +02:00
2017-12-25 14:23:37 +01:00
2020-04-02 17:20:39 +02:00
2021-12-14 10:04:48 +01:00
2018-12-05 19:42:42 +01:00