Skip to contentSkip to conversation

net: sched: do not allocate a tracker in tcf_exts_init()

PATCH Applied Eric Dumazet 2 participants 2 messages Jan 10, 2022 – Jan 12, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sched: do not allocate a tracker in tcf_exts_init()

From: Eric Dumazet <[email protected]>

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")
---
 include/net/pkt_cls.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/net/pkt_cls.h +3 -1
index ebef45e821afd51e407dc19d83d0ad10759e7aba..676cb8ea9e15cae4b098b461918ea0ff49d97768 100644
@@ -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)
Signature · 1 line
2.34.1.575.g55b058a8bb-goog
#1 lore raw
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 10 Jan 2022 01:47:50 -0800 you wrote:

From: Eric Dumazet <[email protected]>

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")

[...]

Here is the summary with links:
- [net-next] net: sched: do not allocate a tracker in tcf_exts_init()

    https://git.kernel.org/netdev/net/c/cb963a19d99f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html