net/sched: act_ct: set net pointer before publishing flowtable
Subsystems (4)
PATCH 1/1 net/sched: act_ct: set net pointer before publishing flowtable
nf_flow_table_init() adds the flowtable to the global flowtables list. However, tcf_ct_flow_table_get() sets the table's network namespace only after that call, leaving a window where the published table has a NULL namespace pointer.
Set the namespace before calling nf_flow_table_init() so that flowtable list walkers can rely on it being initialized.
--- net/sched/act_ct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_ct.c +1 -1
@@ -349,10 +349,10 @@ static int tcf_ct_flow_table_get(struct net *net, struct tcf_ct_params *params) ct_ft->nf_ft.type = &flowtable_ct; ct_ft->nf_ft.flags |=NF_FLOWTABLE_HW_OFFLOAD |NF_FLOWTABLE_COUNTER ; +write_pnet (&ct_ft->nf_ft.net, net); 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:
Signature · 1 line
2.43.0
Quoted 4 lines
nf_flow_table_init()adds the flowtable to the global flowtables list. However,tcf_ct_flow_table_get()sets the table's network namespace only after that call, leaving a window where the published table has a NULL namespace pointer.
The window does exist, but can any existing code path actually read flowtable->net during this window? Could you also describe that path in the commit message?
Thanks,
Xuanqiang
Hi,
Quoted 8 lines · Xuanqiang Luo
Quoted 4 lines
nf_flow_table_init()adds the flowtable to the global flowtables list. However,tcf_ct_flow_table_get()sets the table's network namespace only after that call, leaving a window where the published table has a NULL namespace pointer.The window does exist, but can any existing code path actually read
flowtable->netduring this window? Could you also describe that path in the commit message?
There's none. The patch is a preparation for:
https://lore.kernel.org/netfilter-devel/[email protected]/
Kind regards,
Qingfang
Xuanqiang Luo
Reviewed-byQuoted 8 lines · Qingfang Deng
Hi,
Quoted 5 lines · Xuanqiang Luo
Quoted 4 lines
nf_flow_table_init()adds the flowtable to the global flowtables list. However,tcf_ct_flow_table_get()sets the table's network namespace only after that call, leaving a window where the published table has a NULL namespace pointer.
Quoted 8 lines
Quoted 3 lines
The window does exist, but can any existing code path actually read
flowtable->netduring this window? Could you also describe that path in the commit message?There's none. The patch is a preparation for:
https://lore.kernel.org/netfilter-devel/[email protected]/
Thanks for clarifying.
Thanks,
Xuanqiang