summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-12-10 06:38:30 -0800
committerJakub Kicinski <kuba@kernel.org>2021-12-10 06:38:30 -0800
commit3d20408dff9c0885591c8e1d31a67e9183f0cc8a (patch)
tree509db89a9091f6bbdd5dd5bafb19ed3298ddb494 /include/linux
parente5d75fc20b9278d07731f69e327adf16227813a6 (diff)
parent11b311a867b6b3208fdc3cee8a780f14659bf5f9 (diff)
downloadcachepc-linux-3d20408dff9c0885591c8e1d31a67e9183f0cc8a.tar.gz
cachepc-linux-3d20408dff9c0885591c8e1d31a67e9183f0cc8a.zip
Merge branch 'net-netns-refcount-tracking-base-series'
Eric Dumazet says: ==================== net: netns refcount tracking, base series We have 100+ syzbot reports about netns being dismantled too soon, still unresolved as of today. We think a missing get_net() or an extra put_net() is the root cause. In order to find the bug(s), and be able to spot future ones, this patch adds CONFIG_NET_NS_REFCNT_TRACKER and new helpers to precisely pair all put_net() with corresponding get_net(). To use these helpers, each data structure owning a refcount should also use a "netns_tracker" to pair the get() and put(). Small sections of codes where the get()/put() are in sight do not need to have a tracker, because they are short lived, but in theory it is also possible to declare an on-stack tracker. v2: Include core networking patches only. ==================== Link: https://lore.kernel.org/r/20211210074426.279563-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h9
-rw-r--r--include/linux/seq_file_net.h3
2 files changed, 3 insertions, 9 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1a748ee9a421..235d5d082f1a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -48,7 +48,7 @@
#include <uapi/linux/pkt_cls.h>
#include <linux/hashtable.h>
#include <linux/rbtree.h>
-#include <linux/ref_tracker.h>
+#include <net/net_trackers.h>
struct netpoll_info;
struct device;
@@ -300,13 +300,6 @@ enum netdev_state_t {
__LINK_STATE_TESTING,
};
-
-#ifdef CONFIG_NET_DEV_REFCNT_TRACKER
-typedef struct ref_tracker *netdevice_tracker;
-#else
-typedef struct {} netdevice_tracker;
-#endif
-
struct gro_list {
struct list_head list;
int count;
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
index 0fdbe1ddd8d1..b97912fdbae7 100644
--- a/include/linux/seq_file_net.h
+++ b/include/linux/seq_file_net.h
@@ -9,7 +9,8 @@ extern struct net init_net;
struct seq_net_private {
#ifdef CONFIG_NET_NS
- struct net *net;
+ struct net *net;
+ netns_tracker ns_tracker;
#endif
};