aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorCongyu Liu <liu3101@purdue.edu>2022-01-18 14:20:13 -0500
committerDavid S. Miller <davem@davemloft.net>2022-01-20 10:12:53 +0000
commit47934e06b65637c88a762d9c98329ae6e3238888 (patch)
treeaec48cf65cd8abc38011c80707316a5d94e0ea16 /include/linux/netdevice.h
parentfa2e1ba3e9e39072fa7a6a9d11ac432c505b4ac7 (diff)
downloadlinux-47934e06b65637c88a762d9c98329ae6e3238888.tar.gz
net: fix information leakage in /proc/net/ptype
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>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3213c7227b59bd..e490b84732d165 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2548,6 +2548,7 @@ struct packet_type {
struct net_device *);
bool (*id_match)(struct packet_type *ptype,
struct sock *sk);
+ struct net *af_packet_net;
void *af_packet_priv;
struct list_head list;
};