diff mbox series

[SRU,J:linux-bluefield,1/1] net/sched: act_ct: set 'net' pointer when creating new nf_flow_table

Message ID 20240710130453.3242707-2-danielj@nvidia.com
State New
Headers show
Series Fix ct crash | expand

Commit Message

Daniel Jurgens July 10, 2024, 1:04 p.m. UTC
From: Vlad Buslov <vladbu@nvidia.com>

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/2071715

Following patches in series use the pointer to access flow table offload
debug variables.

(cherry picked from commit fc54d9065f90dd25063883f404e6ff9a76913e73)
Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Oz Shlomo <ozsh@nvidia.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
---
 net/sched/act_ct.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index 94ad56eccb09..e390fb25caef 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -287,7 +287,7 @@  static struct nf_flowtable_type flowtable_ct = {
 	.owner		= THIS_MODULE,
 };
 
-static int tcf_ct_flow_table_get(struct tcf_ct_params *params)
+static int tcf_ct_flow_table_get(struct net *net, struct tcf_ct_params *params)
 {
 	struct tcf_ct_flow_table *ct_ft;
 	int err = -ENOMEM;
@@ -313,6 +313,7 @@  static int tcf_ct_flow_table_get(struct tcf_ct_params *params)
 	err = nf_flow_table_init(&ct_ft->nf_ft);
 	if (err)
 		goto err_init;
+	write_pnet(&ct_ft->nf_ft.net, net);
 
 	__module_get(THIS_MODULE);
 out_unlock:
@@ -1435,7 +1436,7 @@  static int tcf_ct_init(struct net *net, struct nlattr *nla,
 	if (err)
 		goto cleanup;
 
-	err = tcf_ct_flow_table_get(params);
+	err = tcf_ct_flow_table_get(net, params);
 	if (err)
 		goto cleanup_params;