[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y4Tf2BaN5DzibJKl@salvia>
Date: Mon, 28 Nov 2022 17:20:40 +0100
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Xin Long <lucien.xin@...il.com>
Cc: netfilter-devel@...r.kernel.org,
network dev <netdev@...r.kernel.org>,
Florian Westphal <fw@...len.de>,
Jozsef Kadlecsik <kadlec@...filter.org>, davem@...emloft.net,
kuba@...nel.org, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH nf] netfilter: fix using __this_cpu_add in preemptible in
nf_flow_table_offload
On Thu, Nov 24, 2022 at 12:54:10PM -0500, Xin Long wrote:
> flow_offload_queue_work() can be called in workqueue without
> bh disabled, like the call trace showed in my act_ct testing,
> calling NF_FLOW_TABLE_STAT_INC() there would cause a call
> trace:
>
> BUG: using __this_cpu_add() in preemptible [00000000] code: kworker/u4:0/138560
> caller is flow_offload_queue_work+0xec/0x1b0 [nf_flow_table]
> Workqueue: act_ct_workqueue tcf_ct_flow_table_cleanup_work [act_ct]
> Call Trace:
> <TASK>
> dump_stack_lvl+0x33/0x46
> check_preemption_disabled+0xc3/0xf0
> flow_offload_queue_work+0xec/0x1b0 [nf_flow_table]
> nf_flow_table_iterate+0x138/0x170 [nf_flow_table]
> nf_flow_table_free+0x140/0x1a0 [nf_flow_table]
> tcf_ct_flow_table_cleanup_work+0x2f/0x2b0 [act_ct]
> process_one_work+0x6a3/0x1030
> worker_thread+0x8a/0xdf0
>
> This patch fixes it by using NF_FLOW_TABLE_STAT_INC_ATOMIC()
> instead in flow_offload_queue_work().
>
> Note that for FLOW_CLS_REPLACE branch in flow_offload_queue_work(),
> it may not be called in preemptible path, but it's good to use
> NF_FLOW_TABLE_STAT_INC_ATOMIC() for all cases in
> flow_offload_queue_work().
Applied, thanks
Powered by blists - more mailing lists