summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2022-01-10 10:47:50 +0100
committerJakub Kicinski <kuba@kernel.org>2022-01-12 05:40:16 +0100
commitcb963a19d99fc42d9abf4238968ef85fcc2ef3e3 (patch)
tree9da1ee6289e9e4ed831e5433c1bbd278475d9a72
parentMerge branch 'ipv4-fix-accidental-rto_onlink-flags-passed-to-ip_route_output_... (diff)
downloadlinux-cb963a19d99fc42d9abf4238968ef85fcc2ef3e3.tar.xz
linux-cb963a19d99fc42d9abf4238968ef85fcc2ef3e3.zip
net: sched: do not allocate a tracker in tcf_exts_init()
While struct tcf_exts has a net pointer, it is not refcounted until tcf_exts_get_net() is called. Fixes: dbdcda634ce3 ("net: sched: add netns refcount tracker to struct tcf_exts") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Link: https://lore.kernel.org/r/20220110094750.236478-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--include/net/pkt_cls.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index ebef45e821af..676cb8ea9e15 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -218,8 +218,10 @@ static inline int tcf_exts_init(struct tcf_exts *exts, struct net *net,
#ifdef CONFIG_NET_CLS_ACT
exts->type = 0;
exts->nr_actions = 0;
+ /* Note: we do not own yet a reference on net.
+ * This reference might be taken later from tcf_exts_get_net().
+ */
exts->net = net;
- netns_tracker_alloc(net, &exts->ns_tracker, GFP_KERNEL);
exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *),
GFP_KERNEL);
if (!exts->actions)